Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / lib / Drupal / Core / Entity / EntityRepositoryInterface.php
1 <?php
2
3 namespace Drupal\Core\Entity;
4
5 /**
6  * Provides an interface for an entity repository.
7  */
8 interface EntityRepositoryInterface {
9
10   /**
11    * Loads an entity by UUID.
12    *
13    * Note that some entity types may not support UUIDs.
14    *
15    * @param string $entity_type_id
16    *   The entity type ID to load from.
17    * @param string $uuid
18    *   The UUID of the entity to load.
19    *
20    * @return \Drupal\Core\Entity\EntityInterface|null
21    *   The entity object, or NULL if there is no entity with the given UUID.
22    *
23    * @throws \Drupal\Core\Entity\EntityStorageException
24    *   Thrown in case the requested entity type does not support UUIDs.
25    */
26   public function loadEntityByUuid($entity_type_id, $uuid);
27
28   /**
29    * Loads an entity by the config target identifier.
30    *
31    * @param string $entity_type_id
32    *   The entity type ID to load from.
33    * @param string $target
34    *   The configuration target to load, as returned from
35    *   \Drupal\Core\Entity\EntityInterface::getConfigTarget().
36    *
37    * @return \Drupal\Core\Entity\EntityInterface|null
38    *   The entity object, or NULL if there is no entity with the given config
39    *   target identifier.
40    *
41    * @throws \Drupal\Core\Entity\EntityStorageException
42    *   Thrown if the target identifier is a UUID but the entity type does not
43    *   support UUIDs.
44    *
45    * @see \Drupal\Core\Entity\EntityInterface::getConfigTarget()
46    */
47   public function loadEntityByConfigTarget($entity_type_id, $target);
48
49   /**
50    * Gets the entity translation to be used in the given context.
51    *
52    * This will check whether a translation for the desired language is available
53    * and if not, it will fall back to the most appropriate translation based on
54    * the provided context.
55    *
56    * @param \Drupal\Core\Entity\EntityInterface $entity
57    *   The entity whose translation will be returned.
58    * @param string $langcode
59    *   (optional) The language of the current context. Defaults to the current
60    *   content language.
61    * @param array $context
62    *   (optional) An associative array of arbitrary data that can be useful to
63    *   determine the proper fallback sequence.
64    *
65    * @return \Drupal\Core\Entity\EntityInterface
66    *   An entity object for the translated data.
67    *
68    * @see \Drupal\Core\Language\LanguageManagerInterface::getFallbackCandidates()
69    */
70   public function getTranslationFromContext(EntityInterface $entity, $langcode = NULL, $context = []);
71
72 }