class NotConstraint implements ConstraintInterface

NotConstraint class.

The NotConstraint inverts the result of its value. The value of the NotConstraint must be another constraint.

A typical use case for the NotConstraint is the inversion of whitelists to blacklists. If for example a user should not be able to see entries of a specific content type, it can either be achieved by denying access to those content types or by allowing access to all but the entries of the content type:

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

Methods

__construct(ConstraintInterface $child = null)

NotConstraint constructor.

getChild()

No description

setChild(ConstraintInterface $child)

No description

array
jsonSerialize()

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

Details

at line 44
__construct(ConstraintInterface $child = null)

NotConstraint constructor.

Parameters

ConstraintInterface $child

at line 52
ConstraintInterface|null getChild()

Return Value

ConstraintInterface|null

at line 62
NotConstraint setChild(ConstraintInterface $child)

Parameters

ConstraintInterface $child

Return Value

NotConstraint

at line 74
array jsonSerialize()

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

Return Value

array