annotate core/lib/Drupal/Core/Entity/EntityManager.php @ 17:129ea1e6d783

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