Neos\Flow\Persistence\Generic\Qom\QueryObjectModelFactory::_or PHP Méthode

_or() public méthode

Performs a logical disjunction of two other constraints.
public _or ( Constraint $constraint1, Constraint $constraint2 ) : LogicalOr
$constraint1 Constraint the first constraint; non-null
$constraint2 Constraint the second constraint; non-null
Résultat LogicalOr the Or constraint; non-null
    public function _or(Constraint $constraint1, Constraint $constraint2)
    {
        return new LogicalOr($constraint1, $constraint2);
    }

Usage Example

 /**
  * Performs a logical disjunction of the two given constraints. The method
  * takes one or more constraints and concatenates them with a boolean OR.
  * It also accepts a single array of constraints to be concatenated.
  *
  * @param object $constraint1 The first of multiple constraints or an array of constraints.
  * @return Qom\LogicalOr
  * @throws InvalidNumberOfConstraintsException
  * @api
  */
 public function logicalOr($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.', 1268056289);
     }
     foreach ($constraints as $constraint) {
         $resultingConstraint = $this->qomFactory->_or($resultingConstraint, $constraint);
     }
     return $resultingConstraint;
 }