protected function getCriteria($entity, Constraint $constraint, ObjectManager $em)
    {
        /** @var UniqueEntity $constraint */
        /** @var \Doctrine\ORM\Mapping\ClassMetadata $class */
        $class = $em->getClassMetadata(ClassUtils::getClass($entity));
        $fields = (array) $constraint->fields;
        $criteria = [];

        foreach ($fields as $fieldName) {
            $criteria = $this->findFieldCriteria($criteria, $constraint, $em, $class, $entity, $fieldName);

            if (null === $criteria) {
                break;
            }
        }

        return $criteria;
    }
protected function getCriteria($entity, Constraint $constraint, ObjectManager $em)
    {
        /** @var UniqueEntity $constraint */
        /** @var \Doctrine\ORM\Mapping\ClassMetadata $class */
        $class = $em->getClassMetadata(ClassUtils::getClass($entity));
        $fields = (array) $constraint->fields;
        $criteria = [];

        foreach ($fields as $fieldName) {
            $criteria = $this->findFieldCriteria($criteria, $constraint, $em, $class, $entity, $fieldName);

            if (null === $criteria) {
                break;
            }
        }

        return $criteria;
    }
protected function getCriteria ( $ entity , Constraint $ constraint , ObjectManager $ em ) { /** @var UniqueEntity $constraint */ /** @var \Doctrine\ORM\Mapping\ClassMetadata $class */ $ class = $ em -> getClassMetadata ( ClassUtils :: getClass ( $ entity ) ) ; $ fields = ( array ) $ constraint -> fields ; $ criteria = [ ] ; foreach ( $ fields as $ fieldName ) { $ criteria = $ this -> findFieldCriteria ( $ criteria , $ constraint , $ em , $ class , $ entity , $ fieldName ) ; if ( null === $ criteria ) { break ; } } return $ criteria ; }
Gets criteria.

@param object        $entity
@param Constraint    $constraint
@param ObjectManager $em

@throws ConstraintDefinitionException

@return null|array Null if there is no constraint
Gets criteria .