public function EntityConstraintViolationList::getByFields in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php \Drupal\Core\Entity\EntityConstraintViolationList::getByFields()
- 9 core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php \Drupal\Core\Entity\EntityConstraintViolationList::getByFields()
File
- core/
lib/ Drupal/ Core/ Entity/ EntityConstraintViolationList.php, line 106
Class
- EntityConstraintViolationList
- Implements an entity constraint violation list.
Namespace
Drupal\Core\EntityCode
public function getByFields(array $field_names) {
$this
->groupViolationOffsets();
$violations = [];
foreach (array_intersect_key($this->violationOffsetsByField, array_flip($field_names)) as $offsets) {
foreach ($offsets as $offset) {
$violations[] = $this
->get($offset);
}
}
return new static($this->entity, $violations);
}