comparison core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
1 <?php 1 <?php
2 2
3 namespace Drupal\migrate\Plugin; 3 namespace Drupal\migrate\Plugin;
4 4
5 use Drupal\Core\Cache\CacheBackendInterface; 5 use Drupal\Core\Cache\CacheBackendInterface;
6 use Drupal\Core\Entity\EntityManagerInterface; 6 use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
7 use Drupal\Core\Entity\EntityTypeManagerInterface;
7 use Drupal\Core\Extension\ModuleHandlerInterface; 8 use Drupal\Core\Extension\ModuleHandlerInterface;
8 9
9 /** 10 /**
10 * Plugin manager for migrate destination plugins. 11 * Plugin manager for migrate destination plugins.
11 * 12 *
15 * @see plugin_api 16 * @see plugin_api
16 * 17 *
17 * @ingroup migration 18 * @ingroup migration
18 */ 19 */
19 class MigrateDestinationPluginManager extends MigratePluginManager { 20 class MigrateDestinationPluginManager extends MigratePluginManager {
21 use DeprecatedServicePropertyTrait;
20 22
21 /** 23 /**
22 * The entity manager. 24 * {@inheritdoc}
25 */
26 protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
27
28 /**
29 * The entity type manager.
23 * 30 *
24 * @var \Drupal\Core\Entity\EntityManagerInterface 31 * @var \Drupal\Core\Entity\EntityTypeManagerInterface
25 */ 32 */
26 protected $entityManager; 33 protected $entityTypeManager;
27 34
28 /** 35 /**
29 * Constructs a MigrateDestinationPluginManager object. 36 * Constructs a MigrateDestinationPluginManager object.
30 * 37 *
31 * @param string $type 38 * @param string $type
36 * keyed by the corresponding namespace to look for plugin implementations. 43 * keyed by the corresponding namespace to look for plugin implementations.
37 * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend 44 * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
38 * Cache backend instance to use. 45 * Cache backend instance to use.
39 * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler 46 * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
40 * The module handler to invoke the alter hook with. 47 * The module handler to invoke the alter hook with.
41 * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager 48 * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
42 * The entity manager. 49 * The entity type manager.
43 * @param string $annotation 50 * @param string $annotation
44 * (optional) The annotation class name. Defaults to 51 * (optional) The annotation class name. Defaults to
45 * 'Drupal\migrate\Annotation\MigrateDestination'. 52 * 'Drupal\migrate\Annotation\MigrateDestination'.
46 */ 53 */
47 public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EntityManagerInterface $entity_manager, $annotation = 'Drupal\migrate\Annotation\MigrateDestination') { 54 public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EntityTypeManagerInterface $entity_type_manager, $annotation = 'Drupal\migrate\Annotation\MigrateDestination') {
48 parent::__construct($type, $namespaces, $cache_backend, $module_handler, $annotation); 55 parent::__construct($type, $namespaces, $cache_backend, $module_handler, $annotation);
49 $this->entityManager = $entity_manager; 56 $this->entityTypeManager = $entity_type_manager;
50 } 57 }
51 58
52 /** 59 /**
53 * {@inheritdoc} 60 * {@inheritdoc}
54 * 61 *
55 * A specific createInstance method is necessary to pass the migration on. 62 * A specific createInstance method is necessary to pass the migration on.
56 */ 63 */
57 public function createInstance($plugin_id, array $configuration = [], MigrationInterface $migration = NULL) { 64 public function createInstance($plugin_id, array $configuration = [], MigrationInterface $migration = NULL) {
58 if (substr($plugin_id, 0, 7) == 'entity:' && !$this->entityManager->getDefinition(substr($plugin_id, 7), FALSE)) { 65 if (substr($plugin_id, 0, 7) == 'entity:' && !$this->entityTypeManager->getDefinition(substr($plugin_id, 7), FALSE)) {
59 $plugin_id = 'null'; 66 $plugin_id = 'null';
60 } 67 }
61 return parent::createInstance($plugin_id, $configuration, $migration); 68 return parent::createInstance($plugin_id, $configuration, $migration);
62 } 69 }
63 70