Neos\Flow\Persistence\Doctrine\Query::contains PHP Method

contains() public method

It matches if the multivalued property contains the given operand. If NULL is given as $operand, there will never be a match!
public contains ( string $propertyName, mixed $operand ) : object
$propertyName string The name of the multivalued property to compare against
$operand mixed The value to compare with
return object
    public function contains($propertyName, $operand)
    {
        return '(' . $this->getParamNeedle($operand) . ' MEMBER OF ' . $this->getPropertyNameWithAlias($propertyName) . ')';
    }

Usage Example

 /**
  * @param Query $query
  * @param AssetCollection $assetCollection
  * @return void
  */
 protected function addAssetCollectionToQueryConstraints(Query $query, AssetCollection $assetCollection = null)
 {
     if ($assetCollection === null) {
         return;
     }
     $constraints = $query->getConstraint();
     $query->matching($query->logicalAnd($constraints, $query->contains('assetCollections', $assetCollection)));
 }