Mercurial > hg > isophonics-drupal-site
comparison core/includes/entity.inc @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
9 use Drupal\Core\Entity\Entity\EntityFormDisplay; | 9 use Drupal\Core\Entity\Entity\EntityFormDisplay; |
10 use Drupal\Core\Entity\Entity\EntityViewDisplay; | 10 use Drupal\Core\Entity\Entity\EntityViewDisplay; |
11 | 11 |
12 /** | 12 /** |
13 * Clears the entity render cache for all entity types. | 13 * Clears the entity render cache for all entity types. |
14 * | |
15 * @deprecated in Drupal 8.7.x and will be removed before Drupal 9.0.0. Instead, | |
16 * use \Drupal\Core\Entity\EntityViewBuilderInterface::resetCache() on the | |
17 * required entity types or invalidate specific cache tags. | |
18 * | |
19 * @see https://www.drupal.org/node/3000037 | |
20 * @see \Drupal\Core\Entity\EntityViewBuilderInterface::resetCache() | |
21 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getDefinitions() | |
14 */ | 22 */ |
15 function entity_render_cache_clear() { | 23 function entity_render_cache_clear() { |
24 @trigger_error(__FUNCTION__ . '() is deprecated. Use \Drupal\Core\Entity\EntityViewBuilderInterface::resetCache() on the required entity types or invalidate specific cache tags instead. See https://www.drupal.org/node/3000037', E_USER_DEPRECATED); | |
16 $entity_manager = Drupal::entityManager(); | 25 $entity_manager = Drupal::entityManager(); |
17 foreach ($entity_manager->getDefinitions() as $entity_type => $info) { | 26 foreach ($entity_manager->getDefinitions() as $entity_type => $info) { |
18 if ($entity_manager->hasHandler($entity_type, 'view_builder')) { | 27 if ($entity_manager->hasHandler($entity_type, 'view_builder')) { |
19 $entity_manager->getViewBuilder($entity_type)->resetCache(); | 28 $entity_manager->getViewBuilder($entity_type)->resetCache(); |
20 } | 29 } |
60 * Whether to reset the internal cache for the requested entity type. | 69 * Whether to reset the internal cache for the requested entity type. |
61 * | 70 * |
62 * @return \Drupal\Core\Entity\EntityInterface|null | 71 * @return \Drupal\Core\Entity\EntityInterface|null |
63 * The entity object, or NULL if there is no entity with the given ID. | 72 * The entity object, or NULL if there is no entity with the given ID. |
64 * | 73 * |
65 * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use | 74 * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use the |
66 * The method overriding Entity::load() for the entity type, e.g. | 75 * entity type storage's load() method. |
67 * \Drupal\node\Entity\Node::load() if the entity type is known. If the | 76 * |
68 * entity type is variable, use the entity manager service to load the entity | 77 * @see https://www.drupal.org/node/2266845 |
69 * from the entity storage: | |
70 * @code | |
71 * \Drupal::entityTypeManager()->getStorage($entity_type)->load($id); | |
72 * @endcode | |
73 * | |
74 * @see \Drupal\Core\Entity\EntityInterface::load() | |
75 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() | |
76 * @see \Drupal\Core\Entity\EntityStorageInterface::load() | |
77 * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage | |
78 * @see \Drupal\Core\Entity\Query\QueryInterface | |
79 */ | 78 */ |
80 function entity_load($entity_type, $id, $reset = FALSE) { | 79 function entity_load($entity_type, $id, $reset = FALSE) { |
80 @trigger_error('entity_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use the entity type storage\'s load() method. See https://www.drupal.org/node/2266845', E_USER_DEPRECATED); | |
81 $controller = \Drupal::entityManager()->getStorage($entity_type); | 81 $controller = \Drupal::entityManager()->getStorage($entity_type); |
82 if ($reset) { | 82 if ($reset) { |
83 $controller->resetCache([$id]); | 83 $controller->resetCache([$id]); |
84 } | 84 } |
85 return $controller->load($id); | 85 return $controller->load($id); |
168 * Whether to reset the internal cache for the requested entity type. | 168 * Whether to reset the internal cache for the requested entity type. |
169 * | 169 * |
170 * @return array | 170 * @return array |
171 * An array of entity objects indexed by their IDs. | 171 * An array of entity objects indexed by their IDs. |
172 * | 172 * |
173 * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use | 173 * @deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use the |
174 * The method overriding Entity::loadMultiple() for the entity type, e.g. | 174 * entity type storage's loadMultiple() method. |
175 * \Drupal\node\Entity\Node::loadMultiple() if the entity type is known. If | 175 * |
176 * the entity type is variable, use the entity manager service to load the | 176 * @see https://www.drupal.org/node/2266845 |
177 * entity from the entity storage: | |
178 * @code | |
179 * \Drupal::entityTypeManager()->getStorage($entity_type)->loadMultiple($id); | |
180 * @endcode | |
181 * | |
182 * @see \Drupal\Core\Entity\EntityInterface::loadMultiple() | |
183 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() | |
184 * @see \Drupal\Core\Entity\EntityStorageInterface::loadMultiple() | |
185 * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage | |
186 * @see \Drupal\Core\Entity\Query\QueryInterface | |
187 */ | 177 */ |
188 function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) { | 178 function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) { |
179 @trigger_error('entity_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use the entity type storage\'s loadMultiple() method. See https://www.drupal.org/node/2266845', E_USER_DEPRECATED); | |
189 $controller = \Drupal::entityManager()->getStorage($entity_type); | 180 $controller = \Drupal::entityManager()->getStorage($entity_type); |
190 if ($reset) { | 181 if ($reset) { |
191 $controller->resetCache($ids); | 182 $controller->resetCache($ids); |
192 } | 183 } |
193 return $controller->loadMultiple($ids); | 184 return $controller->loadMultiple($ids); |