__construct() public method

Creates a new constraint violation list.
public __construct ( array $violations = [] )
$violations array The constraint violations to add to the list
 /**
  * {@inheritdoc}
  *
  * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
  *   The entity that has been validated.
  * @param array $violations
  *   The array of violations.
  */
 public function __construct(FieldableEntityInterface $entity, array $violations = array())
 {
     parent::__construct($violations);
     $this->entity = $entity;
 }