Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / lib / Drupal / Core / Entity / EntityLastInstalledSchemaRepositoryInterface.php
1 <?php
2
3 namespace Drupal\Core\Entity;
4
5 use Drupal\Core\Field\FieldStorageDefinitionInterface;
6
7 /**
8  * Provides an interface for an installed entity definition repository.
9  */
10 interface EntityLastInstalledSchemaRepositoryInterface {
11
12   /**
13    * Gets the entity type definition in its most recently installed state.
14    *
15    * During the application lifetime, entity type definitions can change. For
16    * example, updated code can be deployed. The getDefinition() method will
17    * always return the definition as determined by the current codebase. This
18    * method, however, returns what the definition was when the last time that
19    * one of the \Drupal\Core\Entity\EntityTypeListenerInterface events was last
20    * fired and completed successfully. In other words, the definition that
21    * the entity type's handlers have incorporated into the application state.
22    * For example, if the entity type's storage handler is SQL-based, the
23    * definition for which database tables were created.
24    *
25    * Application management code can check if getDefinition() differs from
26    * getLastInstalledDefinition() and decide whether to:
27    * - Invoke the appropriate \Drupal\Core\Entity\EntityTypeListenerInterface
28    *   event so that handlers react to the new definition.
29    * - Raise a warning that the application state is incompatible with the
30    *   codebase.
31    * - Perform some other action.
32    *
33    * @param string $entity_type_id
34    *   The entity type ID.
35    *
36    * @return \Drupal\Core\Entity\EntityTypeInterface|null
37    *   The installed entity type definition, or NULL if the entity type has
38    *   not yet been installed via onEntityTypeCreate().
39    *
40    * @see \Drupal\Core\Entity\EntityTypeListenerInterface
41    */
42   public function getLastInstalledDefinition($entity_type_id);
43
44   /**
45    * Gets the entity type definitions in their most recently installed state.
46    *
47    * During the application lifetime, entity type definitions can change. For
48    * example, updated code can be deployed. The
49    * \Drupal\Core\Entity\EntityTypeManagerInterface::getDefinitions() method
50    * will always return the definitions as determined by the current codebase.
51    * This method returns the definitions from the last time that a
52    * \Drupal\Core\Entity\EntityTypeListener event was completed. In other words,
53    * the definitions that the entity type's handlers have incorporated into the
54    * application state. For example, if the entity type's storage handler is
55    * SQL-based, the definition for which database tables were created.
56    *
57    * Application management code can check if
58    * \Drupal\Core\Entity\EntityTypeManagerInterface::getDefinitions() differs
59    * from getLastInstalledDefinitions() and decide whether to:
60    * - Invoke the appropriate \Drupal\Core\Entity\EntityTypeListenerInterface
61    *   event so that handlers react to the new definitions.
62    * - Raise a warning that the application state is incompatible with the
63    *   codebase.
64    * - Perform some other action.
65    *
66    * @return \Drupal\Core\Entity\EntityTypeInterface[]
67    *   An array containing the installed definition for all entity types, keyed
68    *   by the entity type ID.
69    */
70   public function getLastInstalledDefinitions();
71
72   /**
73    * Stores the entity type definition in the application state.
74    *
75    * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
76    *   The entity type definition.
77    *
78    * @return $this
79    */
80   public function setLastInstalledDefinition(EntityTypeInterface $entity_type);
81
82   /**
83    * Deletes the entity type definition from the application state.
84    *
85    * @param string $entity_type_id
86    *   The entity type definition identifier.
87    *
88    * @return $this
89    */
90   public function deleteLastInstalledDefinition($entity_type_id);
91
92   /**
93    * Gets the entity type's most recently installed field storage definitions.
94    *
95    * During the application lifetime, field storage definitions can change. For
96    * example, updated code can be deployed. The getFieldStorageDefinitions()
97    * method will always return the definitions as determined by the current
98    * codebase. This method, however, returns what the definitions were when the
99    * last time that one of the
100    * \Drupal\Core\Field\FieldStorageDefinitionListenerInterface events was last
101    * fired and completed successfully. In other words, the definitions that
102    * the entity type's handlers have incorporated into the application state.
103    * For example, if the entity type's storage handler is SQL-based, the
104    * definitions for which database tables were created.
105    *
106    * Application management code can check if getFieldStorageDefinitions()
107    * differs from getLastInstalledFieldStorageDefinitions() and decide whether
108    * to:
109    * - Invoke the appropriate
110    *   \Drupal\Core\Field\FieldStorageDefinitionListenerInterface
111    *   events so that handlers react to the new definitions.
112    * - Raise a warning that the application state is incompatible with the
113    *   codebase.
114    * - Perform some other action.
115    *
116    * @param string $entity_type_id
117    *   The entity type ID.
118    *
119    * @return \Drupal\Core\Field\FieldStorageDefinitionInterface[]
120    *   The array of installed field storage definitions for the entity type,
121    *   keyed by field name.
122    *
123    * @see \Drupal\Core\Entity\EntityTypeListenerInterface
124    */
125   public function getLastInstalledFieldStorageDefinitions($entity_type_id);
126
127   /**
128    * Stores the entity type's field storage definitions in the application state.
129    *
130    * @param string $entity_type_id
131    *   The entity type identifier.
132    * @param \Drupal\Core\Field\FieldStorageDefinitionInterface[] $storage_definitions
133    *   An array of field storage definitions.
134    */
135   public function setLastInstalledFieldStorageDefinitions($entity_type_id, array $storage_definitions);
136
137   /**
138    * Stores the field storage definition in the application state.
139    *
140    * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition
141    *   The field storage definition.
142    */
143   public function setLastInstalledFieldStorageDefinition(FieldStorageDefinitionInterface $storage_definition);
144
145   /**
146    * Deletes the field storage definition from the application state.
147    *
148    * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition
149    *   The field storage definition.
150    */
151   public function deleteLastInstalledFieldStorageDefinition(FieldStorageDefinitionInterface $storage_definition);
152
153 }