Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / system / tests / modules / entity_test / src / Entity / EntityTestCompositeConstraint.php
1 <?php
2
3 namespace Drupal\entity_test\Entity;
4 use Drupal\Core\Entity\EntityTypeInterface;
5
6 /**
7  * Defines a test class for testing composite constraints.
8  *
9  * @ContentEntityType(
10  *   id = "entity_test_composite_constraint",
11  *   label = @Translation("Test entity constraints with composite constraint"),
12  *   entity_keys = {
13  *     "id" = "id",
14  *     "uuid" = "uuid",
15  *     "bundle" = "type",
16  *     "label" = "name"
17  *   },
18  *   handlers = {
19  *     "form" = {
20  *       "default" = "Drupal\entity_test\EntityTestForm"
21  *     }
22  *   },
23  *   base_table = "entity_test_composite_constraint",
24  *   persistent_cache = FALSE,
25  *   constraints = {
26  *     "EntityTestComposite" = {},
27  *     "EntityTestEntityLevel" = {},
28  *   }
29  * )
30  */
31 class EntityTestCompositeConstraint extends EntityTest {
32
33   /**
34    * {@inheritdoc}
35    */
36   public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
37     $fields = parent::baseFieldDefinitions($entity_type);
38
39     $fields['name']->setDisplayOptions('form', [
40       'type' => 'string',
41       'weight' => 0,
42     ]);
43
44     $fields['type']->setDisplayOptions('form', [
45       'type' => 'entity_reference_autocomplete',
46       'weight' => 0,
47     ]);
48
49     return $fields;
50   }
51
52 }