class EntityTestConstraints

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestConstraints.php \Drupal\entity_test\Entity\EntityTestConstraints

Defines a test class for testing the definition of entity level constraints.

Plugin annotation


@ContentEntityType(
  id = "entity_test_constraints",
  label = @Translation("Test entity constraints"),
  entity_keys = {
    "id" = "id",
    "uuid" = "uuid",
    "bundle" = "type",
    "label" = "name"
  },
  base_table = "entity_test_constraints",
  persistent_cache = FALSE,
  constraints = {
    "NotNull" = {}
  }
)

Hierarchy

Expanded class hierarchy of EntityTestConstraints

1 file declares its use of EntityTestConstraints
FileListingTest.php in core/modules/file/tests/src/Functional/FileListingTest.php

File

core/modules/system/tests/modules/entity_test/src/Entity/EntityTestConstraints.php, line 29

Namespace

Drupal\entity_test\Entity
View source
class EntityTestConstraints extends EntityTest implements EntityChangedInterface {
  use EntityChangedTrait;
  
  /**
   * {@inheritdoc}
   */
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);
    $fields['changed'] = BaseFieldDefinition::create('changed')->setLabel(t('Changed'));
    return $fields;
  }

}

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