@param $constraint_class

@return array
437189
public function normalizeConstraints($constraint_class = NULL) {
    if ($constraint_class == NULL) {
      $classes = array_keys($this->constraints);
    } else {
      if (isset($this->constraints[$constraint_class])) {
        $classes = array($constraint_class);
      } else {
        return array();
      }
    }

    $new_constraints = array();

    foreach ($classes as $class) {
      switch ($class) {
        case 'Roomify\Bat\Constraint\MinMaxDaysConstraint':
          $new_constraints[$class] = $this->normalizeMinMaxDaysConstraints();
          break;

        case 'Roomify\Bat\Constraint\CheckInDayConstraint':
          $new_constraints[$class] = $this->normalizeCheckInDayConstraints();
          break;

        default:
          if (isset($this->constraints[$class])) {
            $new_constraints[$class] = $this->constraints[$class];
          }
      }
    }

    if ($constraint_class == NULL) {
      return $new_constraints;
    } else {
      return $new_constraints[$constraint_class];
    }
  }
1227888
public function getConstList($include_default = false) {
        static $constCache = array();
        $class             = get_class($this);
        if (!isset($constCache[$class])) {
            $reflector          = new ReflectionObject($this);
            $constCache[$class] = $reflector->getConstants();
        }
        if (!$include_default) {
            $constants = $constCache[$class];
            unset($constants['__DEFAULT']);
            return $constants;
        }
        return $constCache[$class];
    }
628860
private function isArrayConstraint(Constraint $constraint): bool
    {
        return $constraint instanceof Assert\All // << Applied only on array
            || ($constraint instanceof Assert\Choice
                && true === $constraint->multiple // << expect an array multiple choices
            );
    }
391644
protected function parseConstraints(array $constraints)
    {
        $parsedConstraints = [];

        foreach ($constraints as $key=>$keyConstraints) {
            $parsedConstraints[$key] = $this->parseConstraint($keyConstraints);
        }

        return $parsedConstraints;
    }
167276
protected Constraints getConstraints (Component child)
    {
        if (_constraints != null) {
            Constraints c = _constraints.get(child);
            if (c != null) {
                return c;
            }
        }

        return DEFAULT_CONSTRAINTS;
    }
850613
public function getDefAsArray()
    {
        return array_replace(
            [
                'name'              => $this->getName(),
                'type'              => $this->getType(),
                'exposedName'       => $this->getName(),
                'doctrineType'      => $this->getTypeDoctrine(),
                'serializerType'    => $this->getTypeSerializer(),
                'relType'           => self::REL_TYPE_EMBED,
                'isClassType'       => true,
                'constraints'       => [],
                'required'          => false,
                'searchable'        => 0,
            ],
            $this->definition === null ? [
                'required'          => $this->isRequired()
            ] : [
                'exposedName'       => $this->definition->getExposeAs() ?: $this->getName(),
                'title'             => $this->definition->getTitle(),
                'description'       => $this->definition->getDescription(),
                'readOnly'          => $this->definition->getReadOnly(),
                'required'          => $this->definition->getRequired(),
                'searchable'        => $this->definition->getSearchable(),
                'constraints'       => array_map(
                    [Utils\ConstraintNormalizer::class, 'normalize'],
                    $this->definition->getConstraints()
                ),
            ]
        );
    }
888077
public function addConstraints()
    {
        if (static::$constraints) {
            $foreignKey = $this->getForeignKeyName();
            $parentKeyValue = $this->getParentKey();

            //If the foreign key is an array (multi-column relationship), we adjust the query.
            if (is_array($this->foreignKey)) {
                foreach ($this->foreignKey as $index => $key) {
                    list(, $key) = explode('.', $key);
                    $fullKey = $this->getRelated()
                            ->getTable().'.'.$key;
                    $this->query->where($fullKey, '=', $parentKeyValue[$index]);
                    $this->query->whereNotNull($fullKey);
                }
            } else {
                $fullKey = $this->getRelated()
                        ->getTable().'.'.$foreignKey;
                $this->query->where($fullKey, '=', $parentKeyValue);
                $this->query->whereNotNull($fullKey);
            }
        }
    }
157587
protected function getDocFromTypeConstraintOrPayloadDocIfExist(array $constraintList) : ?TypeDoc
    {
        $doc = null;
        // Check if a Type constraint exist or if a constraint have a type documentation
        foreach ($constraintList as $constraint) {
            $doc = $this->createDocFromConstraint($constraint);

            if (null !== $doc) {
                break;
            }
        }

        return $doc;
    }
738058
private function guessPrimaryTypeFromConstraint(Constraint $constraint) : ?TypeDoc
    {
        // Try to guess primary types
        if (null !== ($type = $this->guessSimplePrimaryTypeFromConstraint($constraint))) {
            return $type;
        } elseif ($constraint instanceof Assert\DateTime) {
            return $this->guessDateTimeType($constraint);
        } elseif ($constraint instanceof Assert\Collection) {
            return $this->guestCollectionType($constraint);
        }

        return null;
    }
871724
public function getAsserts()
    {
        $metadata = $this->app['validator.mapping.class_metadata_factory']->getMetadataFor(get_class($this));

        return array_map(
            function ($member) {
                return $member[0]->constraints;
            },
            $metadata->members
        );
    }
722078
public function prepareHasAndBelongsToManyConstraintStatement($type_name, $connection_table, $constraint_name, $field_name)
    {
        $result = [];

        $result[] = 'ALTER TABLE ' . $this->getConnection()->escapeTableName($connection_table);
        $result[] = '    ADD CONSTRAINT ' . $this->getConnection()->escapeFieldName($constraint_name);
        $result[] = '    FOREIGN KEY (' . $field_name . ') REFERENCES ' . $this->getConnection()->escapeTableName($type_name) . '(`id`)';
        $result[] = '    ON UPDATE CASCADE ON DELETE CASCADE;';

        return implode("\n", $result);
    }
102204
public function getConstrainedRows($constraint)
	{
		$this->related->select($this->related->getQualifiedFieldName('*'));

		return $this->getConstrained($constraint);
	}
995427
protected function _constraintsStatement()
    {
        $cons = $this->_sql->getConstraints();
        if (empty($cons)) {
            return null;
        }

        return $this->_parseConstraints();
    }
600531
public static function getConstants() : array
    {
        if (self::$constCacheArray == null) {
            self::$constCacheArray = [];
        }
        $calledClass = get_called_class();
        if (!array_key_exists($calledClass, self::$constCacheArray)) {
            $reflect = new ReflectionClass($calledClass);
            self::$constCacheArray[$calledClass] = $reflect->getConstants();
        }
        return self::$constCacheArray[$calledClass];
    }
359783
public function getExtraFormConstraints()
    {
        if (null === $this->extraFormType) {
            return null;
        }

        $configurationArray = json_decode($this->configuration, true);

        return $configurationArray['extra_form_constraints'];
    }
245921
function getConstList($include_default = false)
    {
        if (isset($this->_c__consts))
            return $this->_c__consts;

        $reflection = new ReflectionClass($this);
        $consts     = $reflection->getConstants();
        if ((bool)$include_default === false)
            unset($consts['__default']);

        return $this->_c__consts = $consts;
    }
291339
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;
    }