From e64d1729a2441ea401de7abc923d3fdefbe856af Mon Sep 17 00:00:00 2001 From: chesn0k Date: Fri, 24 May 2024 10:40:57 +0300 Subject: [PATCH] Use PHP attribute for MigrateProcess plugin. --- templates/Plugin/Migrate/_process/process.twig | 4 ++-- .../_process/_n_deps/src/Plugin/migrate/process/Qux.php | 4 ++-- .../_process/_w_deps/src/Plugin/migrate/process/Qux.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/Plugin/Migrate/_process/process.twig b/templates/Plugin/Migrate/_process/process.twig index 84041ca16..c15570261 100644 --- a/templates/Plugin/Migrate/_process/process.twig +++ b/templates/Plugin/Migrate/_process/process.twig @@ -6,6 +6,7 @@ declare(strict_types=1); namespace Drupal\{{ machine_name }}\Plugin\migrate\process; {% apply sort_namespaces %} +use Drupal\migrate\Attribute\MigrateProcess; use Drupal\migrate\MigrateExecutableInterface; use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\Row; @@ -27,9 +28,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * plugin: {{ plugin_id }} * source: foo * @endcode - * - * @MigrateProcessPlugin(id = "{{ plugin_id }}") */ +#[MigrateProcess('{{ plugin_id }}')] final class {{ class }} extends ProcessPluginBase {% if services %}implements ContainerFactoryPluginInterface {% endif %}{ {% if services %} diff --git a/tests/functional/Generator/Plugin/Migrate/_process/_n_deps/src/Plugin/migrate/process/Qux.php b/tests/functional/Generator/Plugin/Migrate/_process/_n_deps/src/Plugin/migrate/process/Qux.php index 7e79cdaf0..a6a5c9b15 100644 --- a/tests/functional/Generator/Plugin/Migrate/_process/_n_deps/src/Plugin/migrate/process/Qux.php +++ b/tests/functional/Generator/Plugin/Migrate/_process/_n_deps/src/Plugin/migrate/process/Qux.php @@ -4,6 +4,7 @@ namespace Drupal\example\Plugin\migrate\process; +use Drupal\migrate\Attribute\MigrateProcess; use Drupal\migrate\MigrateExecutableInterface; use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\Row; @@ -19,9 +20,8 @@ * plugin: example_qux * source: foo * @endcode - * - * @MigrateProcessPlugin(id = "example_qux") */ +#[MigrateProcess('example_qux')] final class Qux extends ProcessPluginBase { /** diff --git a/tests/functional/Generator/Plugin/Migrate/_process/_w_deps/src/Plugin/migrate/process/Qux.php b/tests/functional/Generator/Plugin/Migrate/_process/_w_deps/src/Plugin/migrate/process/Qux.php index 9f29d316a..69a1caa14 100644 --- a/tests/functional/Generator/Plugin/Migrate/_process/_w_deps/src/Plugin/migrate/process/Qux.php +++ b/tests/functional/Generator/Plugin/Migrate/_process/_w_deps/src/Plugin/migrate/process/Qux.php @@ -6,6 +6,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\migrate\Attribute\MigrateProcess; use Drupal\migrate\MigrateExecutableInterface; use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\Row; @@ -22,9 +23,8 @@ * plugin: example_qux * source: foo * @endcode - * - * @MigrateProcessPlugin(id = "example_qux") */ +#[MigrateProcess('example_qux')] final class Qux extends ProcessPluginBase implements ContainerFactoryPluginInterface { /**