EntityManager.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. <?php
  2. namespace Drupal\Core\Entity;
  3. use Drupal\Core\Field\FieldDefinitionInterface;
  4. use Drupal\Core\Field\FieldStorageDefinitionInterface;
  5. use Symfony\Component\DependencyInjection\ContainerAwareInterface;
  6. use Symfony\Component\DependencyInjection\ContainerAwareTrait;
  7. /**
  8. * Provides a wrapper around many other services relating to entities.
  9. *
  10. * Deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. We cannot
  11. * use the deprecated PHPDoc tag because this service class is still used in
  12. * legacy code paths. Symfony would fail test cases with deprecation warnings.
  13. *
  14. * @todo Enforce the deprecation of each method once
  15. * https://www.drupal.org/node/2578361 is in.
  16. */
  17. class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
  18. use ContainerAwareTrait;
  19. /**
  20. * {@inheritdoc}
  21. *
  22. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  23. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::clearCachedDefinitions()
  24. * instead.
  25. *
  26. * @see https://www.drupal.org/node/2549139
  27. */
  28. public function clearCachedDefinitions() {
  29. $this->container->get('entity_type.manager')->clearCachedDefinitions();
  30. // @todo None of these are plugin managers, and they should not co-opt
  31. // this method for managing its caches. Remove in
  32. // https://www.drupal.org/node/2549143.
  33. $this->container->get('entity_type.bundle.info')->clearCachedBundles();
  34. $this->container->get('entity_field.manager')->clearCachedFieldDefinitions();
  35. $this->container->get('entity_type.repository')->clearCachedDefinitions();
  36. }
  37. /**
  38. * {@inheritdoc}
  39. *
  40. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  41. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::getDefinition()
  42. * instead.
  43. *
  44. * @see https://www.drupal.org/node/2549139
  45. */
  46. public function getDefinition($entity_type_id, $exception_on_invalid = TRUE) {
  47. return $this->container->get('entity_type.manager')->getDefinition($entity_type_id, $exception_on_invalid);
  48. }
  49. /**
  50. * {@inheritdoc}
  51. *
  52. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  53. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::hasHandler()
  54. * instead.
  55. *
  56. * @see https://www.drupal.org/node/2549139
  57. */
  58. public function hasHandler($entity_type, $handler_type) {
  59. return $this->container->get('entity_type.manager')->hasHandler($entity_type, $handler_type);
  60. }
  61. /**
  62. * {@inheritdoc}
  63. *
  64. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  65. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() instead.
  66. *
  67. * @see https://www.drupal.org/node/2549139
  68. */
  69. public function getStorage($entity_type) {
  70. return $this->container->get('entity_type.manager')->getStorage($entity_type);
  71. }
  72. /**
  73. * {@inheritdoc}
  74. *
  75. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  76. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::getListBuilder()
  77. * instead.
  78. *
  79. * @see https://www.drupal.org/node/2549139
  80. */
  81. public function getListBuilder($entity_type) {
  82. return $this->container->get('entity_type.manager')->getListBuilder($entity_type);
  83. }
  84. /**
  85. * {@inheritdoc}
  86. *
  87. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  88. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::getFormObject()
  89. * instead.
  90. *
  91. * @see https://www.drupal.org/node/2549139
  92. */
  93. public function getFormObject($entity_type, $operation) {
  94. return $this->container->get('entity_type.manager')->getFormObject($entity_type, $operation);
  95. }
  96. /**
  97. * {@inheritdoc}
  98. *
  99. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  100. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::getRouteProviders()
  101. * instead.
  102. *
  103. * @see https://www.drupal.org/node/2549139
  104. */
  105. public function getRouteProviders($entity_type) {
  106. return $this->container->get('entity_type.manager')->getRouteProviders($entity_type);
  107. }
  108. /**
  109. * {@inheritdoc}
  110. *
  111. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  112. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::getViewBuilder()
  113. * instead.
  114. *
  115. * @see https://www.drupal.org/node/2549139
  116. */
  117. public function getViewBuilder($entity_type) {
  118. return $this->container->get('entity_type.manager')->getViewBuilder($entity_type);
  119. }
  120. /**
  121. * {@inheritdoc}
  122. *
  123. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  124. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::getAccessControlHandler()
  125. * instead.
  126. *
  127. * @see https://www.drupal.org/node/2549139
  128. */
  129. public function getAccessControlHandler($entity_type) {
  130. return $this->container->get('entity_type.manager')->getAccessControlHandler($entity_type);
  131. }
  132. /**
  133. * {@inheritdoc}
  134. *
  135. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  136. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::getHandler() instead.
  137. *
  138. * @see https://www.drupal.org/node/2549139
  139. */
  140. public function getHandler($entity_type, $handler_type) {
  141. return $this->container->get('entity_type.manager')->getHandler($entity_type, $handler_type);
  142. }
  143. /**
  144. * {@inheritdoc}
  145. *
  146. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  147. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::createHandlerInstance()
  148. * instead.
  149. *
  150. * @see https://www.drupal.org/node/2549139
  151. */
  152. public function createHandlerInstance($class, EntityTypeInterface $definition = NULL) {
  153. return $this->container->get('entity_type.manager')->createHandlerInstance($class, $definition);
  154. }
  155. /**
  156. * {@inheritdoc}
  157. *
  158. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  159. * Use \Drupal\Core\Entity\EntityFieldManagerInterface::getBaseFieldDefinitions()
  160. * instead.
  161. *
  162. * @see https://www.drupal.org/node/2549139
  163. */
  164. public function getBaseFieldDefinitions($entity_type_id) {
  165. return $this->container->get('entity_field.manager')->getBaseFieldDefinitions($entity_type_id);
  166. }
  167. /**
  168. * {@inheritdoc}
  169. *
  170. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  171. * Use \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions()
  172. * instead.
  173. *
  174. * @see https://www.drupal.org/node/2549139
  175. */
  176. public function getFieldDefinitions($entity_type_id, $bundle) {
  177. return $this->container->get('entity_field.manager')->getFieldDefinitions($entity_type_id, $bundle);
  178. }
  179. /**
  180. * {@inheritdoc}
  181. *
  182. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  183. * Use \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldStorageDefinitions()
  184. * instead.
  185. *
  186. * @see https://www.drupal.org/node/2549139
  187. */
  188. public function getFieldStorageDefinitions($entity_type_id) {
  189. return $this->container->get('entity_field.manager')->getFieldStorageDefinitions($entity_type_id);
  190. }
  191. /**
  192. * {@inheritdoc}
  193. *
  194. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  195. * Use \Drupal\Core\Entity\EntityFieldManagerInterface::setFieldMap()
  196. * instead.
  197. *
  198. * @see https://www.drupal.org/node/2549139
  199. */
  200. public function setFieldMap(array $field_map) {
  201. return $this->container->get('entity_field.manager')->setFieldMap($field_map);
  202. }
  203. /**
  204. * {@inheritdoc}
  205. *
  206. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  207. * Use \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldMap()
  208. * instead.
  209. *
  210. * @see https://www.drupal.org/node/2549139
  211. */
  212. public function getFieldMap() {
  213. return $this->container->get('entity_field.manager')->getFieldMap();
  214. }
  215. /**
  216. * {@inheritdoc}
  217. *
  218. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  219. * Use \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldMapByFieldType()
  220. * instead.
  221. *
  222. * @see https://www.drupal.org/node/2549139
  223. */
  224. public function getFieldMapByFieldType($field_type) {
  225. return $this->container->get('entity_field.manager')->getFieldMapByFieldType($field_type);
  226. }
  227. /**
  228. * {@inheritdoc}
  229. *
  230. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  231. * Use \Drupal\Core\Field\FieldDefinitionListenerInterface::onFieldDefinitionCreate()
  232. * instead.
  233. *
  234. * @see https://www.drupal.org/node/2549139
  235. */
  236. public function onFieldDefinitionCreate(FieldDefinitionInterface $field_definition) {
  237. $this->container->get('field_definition.listener')->onFieldDefinitionCreate($field_definition);
  238. }
  239. /**
  240. * {@inheritdoc}
  241. *
  242. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  243. * Use \Drupal\Core\Field\FieldDefinitionListenerInterface::onFieldDefinitionUpdate()
  244. * instead.
  245. *
  246. * @see https://www.drupal.org/node/2549139
  247. */
  248. public function onFieldDefinitionUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original) {
  249. $this->container->get('field_definition.listener')->onFieldDefinitionUpdate($field_definition, $original);
  250. }
  251. /**
  252. * {@inheritdoc}
  253. *
  254. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  255. * Use \Drupal\Core\Field\FieldDefinitionListenerInterface::onFieldDefinitionDelete()
  256. * instead.
  257. *
  258. * @see https://www.drupal.org/node/2549139
  259. */
  260. public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition) {
  261. $this->container->get('field_definition.listener')->onFieldDefinitionDelete($field_definition);
  262. }
  263. /**
  264. * {@inheritdoc}
  265. *
  266. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  267. * Use \Drupal\Core\Entity\EntityFieldManagerInterface::clearCachedFieldDefinitions()
  268. * instead.
  269. *
  270. * @see https://www.drupal.org/node/2549139
  271. */
  272. public function clearCachedFieldDefinitions() {
  273. $this->container->get('entity_field.manager')->clearCachedFieldDefinitions();
  274. }
  275. /**
  276. * {@inheritdoc}
  277. *
  278. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  279. * Use \Drupal\Core\Entity\EntityTypeBundleInfoInterface::clearCachedBundles()
  280. * instead.
  281. *
  282. * @see https://www.drupal.org/node/2549139
  283. */
  284. public function clearCachedBundles() {
  285. $this->container->get('entity_type.bundle.info')->clearCachedBundles();
  286. }
  287. /**
  288. * {@inheritdoc}
  289. *
  290. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  291. * Use \Drupal\Core\Entity\EntityTypeBundleInfoInterface::getBundleInfo()
  292. * instead.
  293. *
  294. * @see https://www.drupal.org/node/2549139
  295. */
  296. public function getBundleInfo($entity_type_id) {
  297. return $this->container->get('entity_type.bundle.info')->getBundleInfo($entity_type_id);
  298. }
  299. /**
  300. * {@inheritdoc}
  301. *
  302. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  303. * Use \Drupal\Core\Entity\EntityTypeBundleInfoInterface::getAllBundleInfo()
  304. * instead.
  305. *
  306. * @see https://www.drupal.org/node/2549139
  307. */
  308. public function getAllBundleInfo() {
  309. return $this->container->get('entity_type.bundle.info')->getAllBundleInfo();
  310. }
  311. /**
  312. * {@inheritdoc}
  313. */
  314. public function getExtraFields($entity_type_id, $bundle) {
  315. return $this->container->get('entity_field.manager')->getExtraFields($entity_type_id, $bundle);
  316. }
  317. /**
  318. * {@inheritdoc}
  319. *
  320. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  321. * Use \Drupal\Core\Entity\EntityTypeRepositoryInterface::getEntityTypeLabels()
  322. * instead.
  323. *
  324. * @see https://www.drupal.org/node/2549139
  325. */
  326. public function getEntityTypeLabels($group = FALSE) {
  327. return $this->container->get('entity_type.repository')->getEntityTypeLabels($group);
  328. }
  329. /**
  330. * {@inheritdoc}
  331. *
  332. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  333. * Use \Drupal\Core\Entity\EntityRepositoryInterface::getTranslationFromContext()
  334. * instead.
  335. *
  336. * @see https://www.drupal.org/node/2549139
  337. */
  338. public function getTranslationFromContext(EntityInterface $entity, $langcode = NULL, $context = []) {
  339. return $this->container->get('entity.repository')->getTranslationFromContext($entity, $langcode, $context);
  340. }
  341. /**
  342. * {@inheritdoc}
  343. *
  344. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  345. * Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getAllViewModes()
  346. * instead.
  347. *
  348. * @see https://www.drupal.org/node/2549139
  349. */
  350. public function getAllViewModes() {
  351. return $this->container->get('entity_display.repository')->getAllViewModes();
  352. }
  353. /**
  354. * {@inheritdoc}
  355. *
  356. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  357. * Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getViewModes()
  358. * instead.
  359. *
  360. * @see https://www.drupal.org/node/2549139
  361. */
  362. public function getViewModes($entity_type_id) {
  363. return $this->container->get('entity_display.repository')->getViewModes($entity_type_id);
  364. }
  365. /**
  366. * {@inheritdoc}
  367. *
  368. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  369. * Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getAllFormModes()
  370. * instead.
  371. *
  372. * @see https://www.drupal.org/node/2549139
  373. */
  374. public function getAllFormModes() {
  375. return $this->container->get('entity_display.repository')->getAllFormModes();
  376. }
  377. /**
  378. * {@inheritdoc}
  379. *
  380. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  381. * Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getFormModes()
  382. * instead.
  383. *
  384. * @see https://www.drupal.org/node/2549139
  385. */
  386. public function getFormModes($entity_type_id) {
  387. return $this->container->get('entity_display.repository')->getFormModes($entity_type_id);
  388. }
  389. /**
  390. * {@inheritdoc}
  391. *
  392. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  393. * Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getViewModeOptions()
  394. * instead.
  395. *
  396. * @see https://www.drupal.org/node/2549139
  397. */
  398. public function getViewModeOptions($entity_type_id) {
  399. return $this->container->get('entity_display.repository')->getViewModeOptions($entity_type_id);
  400. }
  401. /**
  402. * {@inheritdoc}
  403. *
  404. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  405. * Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getFormModeOptions()
  406. * instead.
  407. *
  408. * @see https://www.drupal.org/node/2549139
  409. */
  410. public function getFormModeOptions($entity_type_id) {
  411. return $this->container->get('entity_display.repository')->getFormModeOptions($entity_type_id);
  412. }
  413. /**
  414. * {@inheritdoc}
  415. *
  416. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  417. * Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getViewModeOptionsByBundle()
  418. * instead.
  419. *
  420. * @see https://www.drupal.org/node/2549139
  421. */
  422. public function getViewModeOptionsByBundle($entity_type_id, $bundle) {
  423. return $this->container->get('entity_display.repository')->getViewModeOptionsByBundle($entity_type_id, $bundle);
  424. }
  425. /**
  426. * {@inheritdoc}
  427. *
  428. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  429. * Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getFormModeOptionsByBundle()
  430. * instead.
  431. *
  432. * @see https://www.drupal.org/node/2549139
  433. */
  434. public function getFormModeOptionsByBundle($entity_type_id, $bundle) {
  435. return $this->container->get('entity_display.repository')->getFormModeOptionsByBundle($entity_type_id, $bundle);
  436. }
  437. /**
  438. * {@inheritdoc}
  439. *
  440. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  441. * Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::clearDisplayModeInfo()
  442. * instead.
  443. *
  444. * @see https://www.drupal.org/node/2549139
  445. */
  446. public function clearDisplayModeInfo() {
  447. $this->container->get('entity_display.repository')->clearDisplayModeInfo();
  448. }
  449. /**
  450. * {@inheritdoc}
  451. *
  452. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  453. * Use \Drupal\Core\Entity\EntityRepositoryInterface::loadEntityByUuid()
  454. * instead.
  455. *
  456. * @see https://www.drupal.org/node/2549139
  457. */
  458. public function loadEntityByUuid($entity_type_id, $uuid) {
  459. return $this->container->get('entity.repository')->loadEntityByUuid($entity_type_id, $uuid);
  460. }
  461. /**
  462. * {@inheritdoc}
  463. *
  464. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  465. * Use \Drupal\Core\Entity\EntityRepositoryInterface::loadEntityByConfigTarget()
  466. * instead.
  467. *
  468. * @see https://www.drupal.org/node/2549139
  469. */
  470. public function loadEntityByConfigTarget($entity_type_id, $target) {
  471. return $this->container->get('entity.repository')->loadEntityByConfigTarget($entity_type_id, $target);
  472. }
  473. /**
  474. * {@inheritdoc}
  475. *
  476. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  477. * Use \Drupal\Core\Entity\EntityTypeRepositoryInterface::getEntityTypeFromClass()
  478. * instead.
  479. *
  480. * @see https://www.drupal.org/node/2549139
  481. */
  482. public function getEntityTypeFromClass($class_name) {
  483. return $this->container->get('entity_type.repository')->getEntityTypeFromClass($class_name);
  484. }
  485. /**
  486. * {@inheritdoc}
  487. */
  488. public function onEntityTypeCreate(EntityTypeInterface $entity_type) {
  489. $this->container->get('entity_type.listener')->onEntityTypeCreate($entity_type);
  490. }
  491. /**
  492. * {@inheritdoc}
  493. *
  494. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  495. * Use \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeUpdate()
  496. * instead.
  497. *
  498. * @see https://www.drupal.org/node/2549139
  499. */
  500. public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original) {
  501. $this->container->get('entity_type.listener')->onEntityTypeUpdate($entity_type, $original);
  502. }
  503. /**
  504. * {@inheritdoc}
  505. *
  506. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  507. * Use \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeDelete()
  508. * instead.
  509. *
  510. * @see https://www.drupal.org/node/2549139
  511. */
  512. public function onEntityTypeDelete(EntityTypeInterface $entity_type) {
  513. $this->container->get('entity_type.listener')->onEntityTypeDelete($entity_type);
  514. }
  515. /**
  516. * {@inheritdoc}
  517. *
  518. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  519. * Use \Drupal\Core\Field\FieldStorageDefinitionListenerInterface::onFieldStorageDefinitionCreate()
  520. * instead.
  521. *
  522. * @see https://www.drupal.org/node/2549139
  523. */
  524. public function onFieldStorageDefinitionCreate(FieldStorageDefinitionInterface $storage_definition) {
  525. $this->container->get('field_storage_definition.listener')->onFieldStorageDefinitionCreate($storage_definition);
  526. }
  527. /**
  528. * {@inheritdoc}
  529. *
  530. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  531. * Use \Drupal\Core\Field\FieldStorageDefinitionListenerInterface::onFieldStorageDefinitionUpdate()
  532. * instead.
  533. *
  534. * @see https://www.drupal.org/node/2549139
  535. */
  536. public function onFieldStorageDefinitionUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) {
  537. $this->container->get('field_storage_definition.listener')->onFieldStorageDefinitionUpdate($storage_definition, $original);
  538. }
  539. /**
  540. * {@inheritdoc}
  541. *
  542. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  543. * Use \Drupal\Core\Field\FieldStorageDefinitionListenerInterface::onFieldStorageDefinitionDelete()
  544. * instead.
  545. *
  546. * @see https://www.drupal.org/node/2549139
  547. */
  548. public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition) {
  549. $this->container->get('field_storage_definition.listener')->onFieldStorageDefinitionDelete($storage_definition);
  550. }
  551. /**
  552. * {@inheritdoc}
  553. *
  554. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  555. * Use \Drupal\Core\Entity\EntityBundleListenerInterface::onBundleCreate()
  556. * instead.
  557. *
  558. * @see https://www.drupal.org/node/2549139
  559. */
  560. public function onBundleCreate($bundle, $entity_type_id) {
  561. $this->container->get('entity_bundle.listener')->onBundleCreate($bundle, $entity_type_id);
  562. }
  563. /**
  564. * {@inheritdoc}
  565. *
  566. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  567. * Use \Drupal\Core\Entity\EntityBundleListenerInterface::onBundleDelete()
  568. * instead.
  569. *
  570. * @see https://www.drupal.org/node/2549139
  571. */
  572. public function onBundleDelete($bundle, $entity_type_id) {
  573. $this->container->get('entity_bundle.listener')->onBundleDelete($bundle, $entity_type_id);
  574. }
  575. /**
  576. * {@inheritdoc}
  577. *
  578. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  579. * Use \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
  580. * instead.
  581. *
  582. * @see https://www.drupal.org/node/2549139
  583. */
  584. public function getLastInstalledDefinition($entity_type_id) {
  585. return $this->container->get('entity.last_installed_schema.repository')->getLastInstalledDefinition($entity_type_id);
  586. }
  587. /**
  588. * {@inheritdoc}
  589. */
  590. public function useCaches($use_caches = FALSE) {
  591. $this->container->get('entity_type.manager')->useCaches($use_caches);
  592. // @todo EntityFieldManager is not a plugin manager, and should not co-opt
  593. // this method for managing its caches.
  594. $this->container->get('entity_field.manager')->useCaches($use_caches);
  595. }
  596. /**
  597. * {@inheritdoc}
  598. *
  599. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  600. * Use \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledFieldStorageDefinitions()
  601. * instead.
  602. *
  603. * @see https://www.drupal.org/node/2549139
  604. */
  605. public function getLastInstalledFieldStorageDefinitions($entity_type_id) {
  606. return $this->container->get('entity.last_installed_schema.repository')->getLastInstalledFieldStorageDefinitions($entity_type_id);
  607. }
  608. /**
  609. * {@inheritdoc}
  610. *
  611. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  612. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::getDefinitions()
  613. * instead.
  614. *
  615. * @see https://www.drupal.org/node/2549139
  616. */
  617. public function getDefinitions() {
  618. return $this->container->get('entity_type.manager')->getDefinitions();
  619. }
  620. /**
  621. * {@inheritdoc}
  622. *
  623. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  624. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::hasDefinition()
  625. * instead.
  626. *
  627. * @see https://www.drupal.org/node/2549139
  628. */
  629. public function hasDefinition($plugin_id) {
  630. return $this->container->get('entity_type.manager')->hasDefinition($plugin_id);
  631. }
  632. /**
  633. * {@inheritdoc}
  634. *
  635. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  636. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::createInstance()
  637. * instead.
  638. *
  639. * @see https://www.drupal.org/node/2549139
  640. */
  641. public function createInstance($plugin_id, array $configuration = []) {
  642. return $this->container->get('entity_type.manager')->createInstance($plugin_id, $configuration);
  643. }
  644. /**
  645. * {@inheritdoc}
  646. *
  647. * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
  648. * Use \Drupal\Core\Entity\EntityTypeManagerInterface::getInstance()
  649. * instead.
  650. *
  651. * @see https://www.drupal.org/node/2549139
  652. */
  653. public function getInstance(array $options) {
  654. return $this->container->get('entity_type.manager')->getInstance($options);
  655. }
  656. }