class AndConstraint extends LogicConstraint

AndConstraint class.

The AndConstraint evaluates if all its conditions are true. The value of the AndConstraint needs to be an array, with an arbitrary amount of constraints.

The AndConstraint is necessary and useful for a broad variety of use cases. An example for the constraint is the limitation to a specific content type:

{
  "and": [
    {"equals": [{"doc": "sys.type"}, "Entry"]},
    {"equals": [{"doc": "sys.contentType.sys.id"}, "content-type-id"]}
  ]
}

Properties

protected ConstraintInterface[] $children from LogicConstraint

Methods

__construct(array $children = [])

LogicConstraint constructor.

string
getOperator()

No description

setChildren(array $children)

No description

array
jsonSerialize()

Returns an array to be used by "json_encode" to serialize objects of this class.

Details

in LogicConstraint at line 27
__construct(array $children = [])

LogicConstraint constructor.

Parameters

array $children

at line 36
protected string getOperator()

Return Value

string

in LogicConstraint at line 40
ConstraintInterface[] getChildren()

Return Value

ConstraintInterface[]

in LogicConstraint at line 50
LogicConstraint addChild(ConstraintInterface $child)

Parameters

ConstraintInterface $child

Return Value

LogicConstraint

in LogicConstraint at line 62
LogicConstraint setChildren(array $children)

Parameters

array $children

Return Value

LogicConstraint

in LogicConstraint at line 81
LogicConstraint clearChildren()

Return Value

LogicConstraint

in LogicConstraint at line 93
array jsonSerialize()

Returns an array to be used by "json_encode" to serialize objects of this class.

Return Value

array