Skip to content

Commit 9feb5be

Browse files
authored
Merge pull request #171 from Chi-teck/php-attribute-migrate-destination
Use PHP attribute for MigrateDestination plugin
2 parents 730fa2c + 6faa796 commit 9feb5be

File tree

3 files changed

+6
-6
lines changed
  • templates/Plugin/Migrate/_destination
  • tests/functional/Generator/Plugin/Migrate/_destination
    • _n_deps/src/Plugin/migrate/destination
    • _w_deps/src/Plugin/migrate/destination

3 files changed

+6
-6
lines changed

templates/Plugin/Migrate/_destination/destination.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ declare(strict_types=1);
66
namespace Drupal\{{ machine_name }}\Plugin\migrate\destination;
77
88
{% apply sort_namespaces %}
9+
use Drupal\migrate\Attribute\MigrateDestination;
910
use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
1011
use Drupal\migrate\Plugin\MigrationInterface;
1112
use Drupal\migrate\Row;
@@ -18,9 +19,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
1819
1920
/**
2021
* The '{{ plugin_id }}' destination plugin.
21-
*
22-
* @MigrateDestination(id = "{{ plugin_id }}")
2322
*/
23+
#[MigrateDestination('{{ plugin_id }}')]
2424
final class {{ class }} extends DestinationBase {% if services %}implements ContainerFactoryPluginInterface {% endif %}{
2525
2626
{% if services %}

tests/functional/Generator/Plugin/Migrate/_destination/_n_deps/src/Plugin/migrate/destination/Foo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
namespace Drupal\example\Plugin\migrate\destination;
66

7+
use Drupal\migrate\Attribute\MigrateDestination;
78
use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
89
use Drupal\migrate\Plugin\MigrationInterface;
910
use Drupal\migrate\Row;
1011

1112
/**
1213
* The 'example_foo' destination plugin.
13-
*
14-
* @MigrateDestination(id = "example_foo")
1514
*/
15+
#[MigrateDestination('example_foo')]
1616
final class Foo extends DestinationBase {
1717

1818
/**

tests/functional/Generator/Plugin/Migrate/_destination/_w_deps/src/Plugin/migrate/destination/Bar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
use Drupal\Core\Entity\EntityTypeManagerInterface;
88
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
9+
use Drupal\migrate\Attribute\MigrateDestination;
910
use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
1011
use Drupal\migrate\Plugin\MigrationInterface;
1112
use Drupal\migrate\Row;
1213
use Symfony\Component\DependencyInjection\ContainerInterface;
1314

1415
/**
1516
* The 'example_bar' destination plugin.
16-
*
17-
* @MigrateDestination(id = "example_bar")
1817
*/
18+
#[MigrateDestination('example_bar')]
1919
final class Bar extends DestinationBase implements ContainerFactoryPluginInterface {
2020

2121
/**

0 commit comments

Comments
 (0)