class ValidReferenceConstraint

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ValidReferenceConstraint.php \Drupal\Core\Entity\Plugin\Validation\Constraint\ValidReferenceConstraint
  2. 8.9.x core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ValidReferenceConstraint.php \Drupal\Core\Entity\Plugin\Validation\Constraint\ValidReferenceConstraint
  3. 10 core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ValidReferenceConstraint.php \Drupal\Core\Entity\Plugin\Validation\Constraint\ValidReferenceConstraint

Entity Reference valid reference constraint.

Verifies that referenced entities are valid.

Hierarchy

  • class \Drupal\Core\Entity\Plugin\Validation\Constraint\ValidReferenceConstraint extends \Symfony\Component\Validator\Constraint

Expanded class hierarchy of ValidReferenceConstraint

File

core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ValidReferenceConstraint.php, line 14

Namespace

Drupal\Core\Entity\Plugin\Validation\Constraint
View source
class ValidReferenceConstraint extends SymfonyConstraint {
    
    /**
     * The default violation message.
     *
     * @var string
     */
    public $message = 'This entity (%type: %id) cannot be referenced.';
    
    /**
     * Violation message when the entity does not exist.
     *
     * @var string
     */
    public $nonExistingMessage = 'The referenced entity (%type: %id) does not exist.';
    
    /**
     * Violation message when a new entity ("autocreate") is invalid.
     *
     * @var string
     */
    public $invalidAutocreateMessage = 'This entity (%type: %label) cannot be referenced.';
    
    /**
     * Violation message when the target_id is empty.
     *
     * @var string
     */
    public $nullMessage = 'This value should not be null.';

}

Members

Title Sort descending Modifiers Object type Summary
ValidReferenceConstraint::$invalidAutocreateMessage public property Violation message when a new entity ("autocreate") is invalid.
ValidReferenceConstraint::$message public property The default violation message.
ValidReferenceConstraint::$nonExistingMessage public property Violation message when the entity does not exist.
ValidReferenceConstraint::$nullMessage public property Violation message when the target_id is empty.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.