Skip to content

Commit a0dd0ad

Browse files
authored
Merge pull request #170 from Chi-teck/php-attribute-migrate-process
Use PHP attribute for MigrateProcess plugin
2 parents 9feb5be + e64d172 commit a0dd0ad

File tree

3 files changed

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

3 files changed

+6
-6
lines changed

templates/Plugin/Migrate/_process/process.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\process;
77
88
{% apply sort_namespaces %}
9+
use Drupal\migrate\Attribute\MigrateProcess;
910
use Drupal\migrate\MigrateExecutableInterface;
1011
use Drupal\migrate\ProcessPluginBase;
1112
use Drupal\migrate\Row;
@@ -27,9 +28,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
2728
* plugin: {{ plugin_id }}
2829
* source: foo
2930
* @endcode
30-
*
31-
* @MigrateProcessPlugin(id = "{{ plugin_id }}")
3231
*/
32+
#[MigrateProcess('{{ plugin_id }}')]
3333
final class {{ class }} extends ProcessPluginBase {% if services %}implements ContainerFactoryPluginInterface {% endif %}{
3434
3535
{% if services %}

tests/functional/Generator/Plugin/Migrate/_process/_n_deps/src/Plugin/migrate/process/Qux.php

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

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

7+
use Drupal\migrate\Attribute\MigrateProcess;
78
use Drupal\migrate\MigrateExecutableInterface;
89
use Drupal\migrate\ProcessPluginBase;
910
use Drupal\migrate\Row;
@@ -19,9 +20,8 @@
1920
* plugin: example_qux
2021
* source: foo
2122
* @endcode
22-
*
23-
* @MigrateProcessPlugin(id = "example_qux")
2423
*/
24+
#[MigrateProcess('example_qux')]
2525
final class Qux extends ProcessPluginBase {
2626

2727
/**

tests/functional/Generator/Plugin/Migrate/_process/_w_deps/src/Plugin/migrate/process/Qux.php

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

77
use Drupal\Core\Entity\EntityTypeManagerInterface;
88
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
9+
use Drupal\migrate\Attribute\MigrateProcess;
910
use Drupal\migrate\MigrateExecutableInterface;
1011
use Drupal\migrate\ProcessPluginBase;
1112
use Drupal\migrate\Row;
@@ -22,9 +23,8 @@
2223
* plugin: example_qux
2324
* source: foo
2425
* @endcode
25-
*
26-
* @MigrateProcessPlugin(id = "example_qux")
2726
*/
27+
#[MigrateProcess('example_qux')]
2828
final class Qux extends ProcessPluginBase implements ContainerFactoryPluginInterface {
2929

3030
/**

0 commit comments

Comments
 (0)