You are here

public function ContentEntityBase::validate in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::validate()
  2. 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::validate()

Validates the currently set values.

Return value

\Drupal\Core\Entity\EntityConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded.

Overrides FieldableEntityInterface::validate

1 method overrides ContentEntityBase::validate()
Media::validate in core/modules/media/src/Entity/Media.php
Validates the currently set values.

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 487

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

public function validate() {
  $this->validated = TRUE;
  $violations = $this
    ->getTypedData()
    ->validate();
  return new EntityConstraintViolationList($this, iterator_to_array($violations));
}