/**
  * {@inheritdoc}
  */
 public function getConstraints()
 {
     $constraints = parent::getConstraints();
     // Remove the 'AllowedValuesConstraint' validation constraint because entity
     // reference fields already use the 'ValidReference' constraint.
     foreach ($constraints as $key => $constraint) {
         if ($constraint instanceof AllowedValuesConstraint) {
             unset($constraints[$key]);
         }
     }
     return $constraints;
 }