Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / system / tests / modules / entity_test / src / Entity / EntityTestConstraints.php
1 <?php
2
3 namespace Drupal\entity_test\Entity;
4
5 use Drupal\Core\Entity\EntityChangedTrait;
6 use Drupal\Core\Entity\EntityTypeInterface;
7 use Drupal\Core\Entity\EntityChangedInterface;
8 use Drupal\Core\Field\BaseFieldDefinition;
9
10 /**
11  * Defines a test class for testing the definition of entity level constraints.
12  *
13  * @ContentEntityType(
14  *   id = "entity_test_constraints",
15  *   label = @Translation("Test entity constraints"),
16  *   entity_keys = {
17  *     "id" = "id",
18  *     "uuid" = "uuid",
19  *     "bundle" = "type",
20  *     "label" = "name"
21  *   },
22  *   base_table = "entity_test_constraints",
23  *   persistent_cache = FALSE,
24  *   constraints = {
25  *     "NotNull" = {}
26  *   }
27  * )
28  */
29 class EntityTestConstraints extends EntityTest implements EntityChangedInterface {
30
31   use EntityChangedTrait;
32
33   /**
34    * {@inheritdoc}
35    */
36   public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
37     $fields = parent::baseFieldDefinitions($entity_type);
38
39     $fields['changed'] = BaseFieldDefinition::create('changed')
40       ->setLabel(t('Changed'));
41
42     return $fields;
43   }
44
45 }