Skip to content

Commit

Permalink
Merge pull request #171 from Chi-teck/php-attribute-migrate-destination
Browse files Browse the repository at this point in the history
Use PHP attribute for MigrateDestination plugin
  • Loading branch information
Chi-teck authored May 24, 2024
2 parents 730fa2c + 6faa796 commit 9feb5be
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions templates/Plugin/Migrate/_destination/destination.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ declare(strict_types=1);
namespace Drupal\{{ machine_name }}\Plugin\migrate\destination;

{% apply sort_namespaces %}
use Drupal\migrate\Attribute\MigrateDestination;
use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Row;
Expand All @@ -18,9 +19,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* The '{{ plugin_id }}' destination plugin.
*
* @MigrateDestination(id = "{{ plugin_id }}")
*/
#[MigrateDestination('{{ plugin_id }}')]
final class {{ class }} extends DestinationBase {% if services %}implements ContainerFactoryPluginInterface {% endif %}{

{% if services %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace Drupal\example\Plugin\migrate\destination;

use Drupal\migrate\Attribute\MigrateDestination;
use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Row;

/**
* The 'example_foo' destination plugin.
*
* @MigrateDestination(id = "example_foo")
*/
#[MigrateDestination('example_foo')]
final class Foo extends DestinationBase {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\Attribute\MigrateDestination;
use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Row;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* The 'example_bar' destination plugin.
*
* @MigrateDestination(id = "example_bar")
*/
#[MigrateDestination('example_bar')]
final class Bar extends DestinationBase implements ContainerFactoryPluginInterface {

/**
Expand Down

0 comments on commit 9feb5be

Please sign in to comment.