/**
  * @param ClassMetadataInterface $validatorMetadata
  * @param string $columnName
  *
  * @return array
  */
 protected function getValidationRules($validatorMetadata, $columnName)
 {
     $metadata = $validatorMetadata->getPropertyMetadata($columnName);
     $metadata = is_array($metadata) && isset($metadata[0]) ? $metadata[0] : $metadata;
     $rules = [];
     foreach ($metadata->getConstraints() as $constraint) {
         $reflectionClass = new \ReflectionClass($constraint);
         $rules[$reflectionClass->getShortName()] = (array) $constraint;
     }
     return $rules;
 }
 /**
  * Get the constraints attached to a property.
  *
  * @param ClassMetadataInterface $classMetadata
  * @param string $property
  * @return \Symfony\Component\Validator\Constraint[]
  */
 protected static function getClassPropertyConstraints(ClassMetadataInterface $classMetadata, $property)
 {
     if (!$classMetadata->hasPropertyMetadata($property)) {
         return [];
     }
     $constraints = [];
     foreach ($classMetadata->getPropertyMetadata($property) as $metadata) {
         if (!$metadata instanceof MetadataInterface) {
             continue;
         }
         foreach ($metadata->getConstraints() as $constraint) {
             $constraints[] = $constraint;
         }
     }
     return $constraints;
 }