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 (   $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

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 (   $type)

Set the PersistentObject type that has the attribute.

Parameters
$typeThe type name

Definition at line 66 of file Criteria.php.

getType ( )

Get the PersistentObject type that has the attribute.

Returns
String

Definition at line 74 of file Criteria.php.

setAttribute (   $attribute)

Set the name of the attribute.

Parameters
$attributeThe attribute name

Definition at line 82 of file Criteria.php.

getAttribute ( )

Get the name of the attribute.

Returns
String

Definition at line 90 of file Criteria.php.

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 ( )

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 (   $value)

Set the value to compare the object with.

Parameters
$valueThe value

Definition at line 116 of file Criteria.php.

getValue ( )

Get the value to compare the object with.

Returns
Mixed

Definition at line 124 of file Criteria.php.

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 ( )

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 ( )

Get an identifier for the instance.

Returns
String

Definition at line 148 of file Criteria.php.

__toString ( )

Get a string representation of the criteria.

Returns
String

Definition at line 158 of file Criteria.php.

Member Data Documentation

const OPERATOR_AND = 'AND'

Definition at line 23 of file Criteria.php.

const OPERATOR_OR = 'OR'

Definition at line 24 of file Criteria.php.

$type = null
protected

Definition at line 26 of file Criteria.php.

$attribute = null
protected

Definition at line 27 of file Criteria.php.

$operator=null
protected

Definition at line 28 of file Criteria.php.

$value = null
protected

Definition at line 29 of file Criteria.php.

$combineOperator = Criteria::OPERATOR_AND
protected

Definition at line 30 of file Criteria.php.