function DataReferenceTargetDefinition::getConstraints
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/DataReferenceTargetDefinition.php \Drupal\Core\TypedData\DataReferenceTargetDefinition::getConstraints()
- 8.9.x core/lib/Drupal/Core/TypedData/DataReferenceTargetDefinition.php \Drupal\Core\TypedData\DataReferenceTargetDefinition::getConstraints()
- 10 core/lib/Drupal/Core/TypedData/DataReferenceTargetDefinition.php \Drupal\Core\TypedData\DataReferenceTargetDefinition::getConstraints()
Overrides DataDefinition::getConstraints
File
-
core/
lib/ Drupal/ Core/ TypedData/ DataReferenceTargetDefinition.php, line 22
Class
- DataReferenceTargetDefinition
- A typed data definition class for the entity reference target_id property.
Namespace
Drupal\Core\TypedDataCode
public function getConstraints() {
$constraints = parent::getConstraints();
// If this data definition is marked as required for the sake of schema
// definitions, we don't enforce it using the NotNull constraint. Instead
// \Drupal\Core\Field\EntityReferenceItem is validated by the
// 'ValidReference' constraint that operates at the field-item level. This
// constraint takes into consideration that the target_id property can
// be derived from the entity property.
unset($constraints['NotNull']);
return $constraints;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.