Detailed Description

Criteria defines a condition on a PersistentObject's attribute used to select specific instances.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 21 of file Criteria.php.

Public Member Functions

 __construct ($type, $attribute, $operator, $value, $combineOperator=Criteria::OPERATOR_AND)
 
 setType ($type)
 
 getType ()
 
 setAttribute ($attribute)
 
 getAttribute ()
 
 setOperator ($operator)
 
 getOperator ()
 
 setValue ($value)
 
 getValue ()
 
 setCombineOperator ($combineOperator)
 
 getCombineOperator ()
 
 getId ()
 
 __toString ()
 

Static Public Member Functions

static asValue ($operator, $value)
 

Public Attributes

const OPERATOR_AND = 'AND'
 
const OPERATOR_OR = 'OR'
 

Protected Attributes

 $type = null
 
 $attribute = null
 
 $operator=null
 
 $value = null
 
 $combineOperator = Criteria::OPERATOR_AND
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $type,
  $attribute,
  $operator,
  $value,
  $combineOperator = Criteria::OPERATOR_AND 
)

Constructor.

Parameters
$typeThe PersistentObject type that has the attribute
$attributeThe name of the attribute
$operatorThe comparison operator used to compare the given value with the attribute's value
$valueThe value to compare the object with
$combineOperatorThe Criteria::OPERATOR to use, when this criteria is combined with other criteria (optional, default: Criteria::OPERATOR_AND)

Definition at line 42 of file Criteria.php.

Member Function Documentation

◆ asValue()

static asValue (   $operator,
  $value 
)
static

Factory method for constructing a Criteria that may be used as value on a PersistentObject's attribute (no type, attribute parameter needed)

Parameters
$operatorThe comparison operator used to compare the given value with the attribute's value
$valueThe value to compare the object with
Returns
Criteria

Definition at line 58 of file Criteria.php.

◆ setType()

setType (   $type)

Set the PersistentObject type that has the attribute.

Parameters
$typeThe type name

Definition at line 66 of file Criteria.php.

◆ getType()

getType ( )

Get the PersistentObject type that has the attribute.

Returns
String

Definition at line 74 of file Criteria.php.

◆ setAttribute()

setAttribute (   $attribute)

Set the name of the attribute.

Parameters
$attributeThe attribute name

Definition at line 82 of file Criteria.php.

◆ getAttribute()

getAttribute ( )

Get the name of the attribute.

Returns
String

Definition at line 90 of file Criteria.php.

◆ setOperator()

setOperator (   $operator)

Set the comparison operator used to compare the given value with the attribute's value.

Parameters
$operatorThe operator

Definition at line 99 of file Criteria.php.

◆ getOperator()

getOperator ( )

Get the comparison operator used to compare the given value with the attribute's value.

Returns
String

Definition at line 108 of file Criteria.php.

◆ setValue()

setValue (   $value)

Set the value to compare the object with.

Parameters
$valueThe value

Definition at line 116 of file Criteria.php.

◆ getValue()

getValue ( )

Get the value to compare the object with.

Returns
Mixed

Definition at line 124 of file Criteria.php.

◆ setCombineOperator()

setCombineOperator (   $combineOperator)

Set the Criteria::OPERATOR to use, when this criteria is combined with other criteria.

Parameters
$combineOperatorOne of the Criteria::OPERATOR constants

Definition at line 132 of file Criteria.php.

◆ getCombineOperator()

getCombineOperator ( )

Get the Criteria::OPERATOR to use, when this criteria is combined with other criteria.

Returns
One of the Criteria::OPERATOR constants

Definition at line 140 of file Criteria.php.

◆ getId()

getId ( )

Get an identifier for the instance.

Returns
String

Definition at line 148 of file Criteria.php.

◆ __toString()

__toString ( )

Get a string representation of the criteria.

Returns
String

Definition at line 158 of file Criteria.php.

Member Data Documentation

◆ OPERATOR_AND

const OPERATOR_AND = 'AND'

Definition at line 23 of file Criteria.php.

◆ OPERATOR_OR

const OPERATOR_OR = 'OR'

Definition at line 24 of file Criteria.php.

◆ $type

$type = null
protected

Definition at line 26 of file Criteria.php.

◆ $attribute

$attribute = null
protected

Definition at line 27 of file Criteria.php.

◆ $operator=null

$operator=null
protected

Definition at line 28 of file Criteria.php.

◆ $value

$value = null
protected

Definition at line 29 of file Criteria.php.

◆ $combineOperator

$combineOperator = Criteria::OPERATOR_AND
protected

Definition at line 30 of file Criteria.php.