Neos\Flow\Persistence\Generic\Qom\QueryObjectModelFactory::_and PHP Метод

_and() публичный Метод

Performs a logical conjunction of two other constraints.
public _and ( Constraint $constraint1, Constraint $constraint2 ) : LogicalAnd
$constraint1 Constraint the first constraint; non-null
$constraint2 Constraint the second constraint; non-null
Результат LogicalAnd the And constraint; non-null
    public function _and(Constraint $constraint1, Constraint $constraint2)
    {
        return new LogicalAnd($constraint1, $constraint2);
    }

Usage Example

Пример #1
0
 /**
  * Performs a logical conjunction of the two given constraints. The method
  * takes one or more contraints and concatenates them with a boolean AND.
  * It also accepts a single array of constraints to be concatenated.
  *
  * @param mixed $constraint1 The first of multiple constraints or an array of constraints.
  * @return Qom\LogicalAnd
  * @throws InvalidNumberOfConstraintsException
  * @api
  */
 public function logicalAnd($constraint1)
 {
     if (is_array($constraint1)) {
         $resultingConstraint = array_shift($constraint1);
         $constraints = $constraint1;
     } else {
         $constraints = func_get_args();
         $resultingConstraint = array_shift($constraints);
     }
     if ($resultingConstraint === null) {
         throw new InvalidNumberOfConstraintsException('There must be at least one constraint or a non-empty array of constraints given.', 1268056288);
     }
     foreach ($constraints as $constraint) {
         $resultingConstraint = $this->qomFactory->_and($resultingConstraint, $constraint);
     }
     return $resultingConstraint;
 }