Split large entities into focused sub-entities. Automate target field creation, source→target references, form modes, and data migration from a source entity into your pre-created sub-entities via Drush.

Entity Splitter helps you refactor large, monolithic entities into smaller, focused sub-entities. It automates creating target-side fields, reference fields on the source entity, form modes, and migrating field data from the source to your pre-existing sub-entities. (This works best for field group mapping, yaml mapping will become more importing in version 2.0.x)

Project link

https://www.drupal.org/project/entity_splitter

Comments

remco hoeneveld created an issue. See original summary.

vishal.kadam’s picture

Issue summary: View changes
avpaderno’s picture

Thank you for applying!

Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.

The important notes are the following.

  • New releases are not necessary for these applications, which could require changes that are not backward-compatible. Not creating new releases avoids any possible issue.
  • Please do not change the branch to review once reviews started, except in the case the used branch needs to be deleted.
  • If you have not done it yet, enable GitLab CI for the project, and fix what reported from the phpcs job. This help to fix most of what reviewers would report.
  • For the time this application is open, only your commits are allowed. No other people, including other maintainers/co-maintainers can make commits.
  • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application.
  • Nobody else will get the permission to opt projects into security advisory policy. If there are other maintainers/co-maintainers who will to get that permission, they need to apply with a different module.
  • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

To the reviewers

Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.

The important notes are the following.

  • It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
  • Reviewers should show the output of a CLI tool only once per application. The configuration used for these tools needs to be the same configuration used by GitLab CI, stored in the GitLab Templates repository.
  • It may be best to have the applicant fix things before further review.

For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.

vishal.kadam’s picture

Status: Needs review » Needs work

1. The project is missing a README.md file that follows the template suggested in README.md template.

2. FILE: src/EntitySplitterActions.php

  /**
   * The plugin manager.
   *
   * @var \Drupal\entity_splitter\EntitySplitterManager
   */
  private EntitySplitterManager $pluginManager;

  /**
   * The logger channel.
   *
   * @var \Drupal\Core\Logger\LoggerChannelInterface
   */
  private LoggerChannelInterface $logger;

  /**
   * The file system.
   *
   * @var \Drupal\Core\File\FileSystemInterface
   */
  private FileSystemInterface $fileSystem;

  /**
   * The YAML reader.
   *
   * @var \Drupal\entity_splitter\Mapping\YamlMappingReader
   */
  private YamlMappingReader $yamlReader;

  /**
   * The field group mapper.
   *
   * @var \Drupal\entity_splitter\Mapping\FieldGroupMapper
   */
  private FieldGroupMapper $fieldGroupMapper;

  /**
   * Constructs an entity splitter actions object.
   *
   * @param \Drupal\entity_splitter\EntitySplitterManager $plugin_manager
   *   The plugin manager.
   * @param \Drupal\Core\File\FileSystemInterface $file_system
   *   The file system.
   * @param \Drupal\entity_splitter\Mapping\YamlMappingReader $yaml_reader
   *   The yaml reader.
   * @param \Drupal\entity_splitter\Mapping\FieldGroupMapper $field_group_mapper
   *   The field group mapper.
   * @param \Drupal\Core\Logger\LoggerChannelInterface $logger
   *   The logger.
   */
  public function __construct(EntitySplitterManager $plugin_manager, FileSystemInterface $file_system, YamlMappingReader $yaml_reader, FieldGroupMapper $field_group_mapper, LoggerChannelInterface $logger) {
    $this->pluginManager = $plugin_manager;
    $this->fileSystem = $file_system;
    $this->yamlReader = $yaml_reader;
    $this->fieldGroupMapper = $field_group_mapper;
    $this->logger = $logger;
  }

FILE: src/Commands/EntitySplitterCommands.php

  /**
   * The entity migration runner.
   *
   * @var \Drupal\entity_splitter\EntitySplitterActions
   */
  protected EntitySplitterActions $actions;

  /**
   * Construct the entity migration commands.
   *
   * @param \Drupal\entity_splitter\EntitySplitterActions $actions
   *   The actions (run / migrate).
   */
  public function __construct(EntitySplitterActions $actions) {
    parent::__construct();
    $this->actions = $actions;
  }

FILE: src/Mapping/FieldGroupMapper.php

  /**
   * The module handler.
   *
   * @var \Drupal\Core\Extension\ModuleHandlerInterface
   */
  protected ModuleHandlerInterface $moduleHandler;

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected ConfigFactoryInterface $configFactory;

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected EntityTypeManagerInterface $entityTypeManager;

  /**
   * Constructs a field group mapper.
   *
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   */
  public function __construct(
    ModuleHandlerInterface $module_handler,
    ConfigFactoryInterface $config_factory,
    EntityTypeManagerInterface $entity_type_manager,
  ) {
    $this->moduleHandler = $module_handler;
    $this->configFactory = $config_factory;
    $this->entityTypeManager = $entity_type_manager;
  }

FILE: src/Plugin/EntitySplitterBase.php

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected EntityTypeManagerInterface $entityTypeManager;

  /**
   * The entity field manager.
   *
   * @var \Drupal\Core\Entity\EntityFieldManagerInterface
   */
  protected EntityFieldManagerInterface $entityFieldManager;

  /**
   * Generic processor that abstracts common migration steps.
   *
   * @var \Drupal\entity_splitter\Processing\EntitySplitterProcessor
   */
  protected EntitySplitterProcessor $processor;

  /**
   * The entity migration processor.
   *
   * @var \Drupal\entity_splitter\Processing\EntitySplitterProcessor
   */
  protected EntitySplitterProcessor $entitySplitterProcessor;

  /**
   * The logger.
   *
   * @var \Drupal\Core\Logger\LoggerChannelInterface
   */
  protected LoggerChannelInterface $logger;

  /**
   * Construct an entity migration base.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
   *   The entity field manager.
   * @param \Drupal\entity_splitter\Processing\EntitySplitterProcessor $entity_splitter_processor
   *   The entity migration processor.
   * @param \Drupal\Core\Logger\LoggerChannelInterface $logger
   *   The logger channel.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, EntitySplitterProcessor $entity_splitter_processor, LoggerChannelInterface $logger) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->entityTypeManager = $entity_type_manager;
    $this->entityFieldManager = $entity_field_manager;
    $this->entitySplitterProcessor = $entity_splitter_processor;
    $this->logger = $logger;
  }

FILE: src/Plugin/QueueWorker/EntitySplitterDataMigrationQueue.php

  /**
   * The delay interval equal to 15 minutes.
   */
  const int DELAY_INTERVAL = 900;

  /**
   * The entity type manager service.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected EntityTypeManagerInterface $entityTypeManager;

  /**
   * The entity splitter actions.
   *
   * @var \Drupal\entity_splitter\EntitySplitterActions
   */
  protected EntitySplitterActions $entitySplitterActions;

  /**
   * The entity splitter processor.
   *
   * @var \Drupal\entity_splitter\Processing\EntitySplitterProcessor
   */
  protected EntitySplitterProcessor $entitySplitterProcessor;

  /**
   * The logger interface.
   *
   * @var \Psr\Log\LoggerInterface
   */
  protected LoggerInterface $logger;

  /**
   * Constructs a new class instance.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin ID for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   Entity type manager service.
   * @param \Drupal\entity_splitter\EntitySplitterActions $entity_splitter_actions
   *   Entity splitter actions.
   * @param \Drupal\entity_splitter\Processing\EntitySplitterProcessor $entity_splitter_processor
   *   Entity splitter processor.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntitySplitterActions $entity_splitter_actions, EntitySplitterProcessor $entity_splitter_processor) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->entityTypeManager = $entity_type_manager;
    $this->entitySplitterActions = $entity_splitter_actions;
    $this->entitySplitterProcessor = $entity_splitter_processor;
    $this->logger = $this->getLogger('entity_splitter');
  }

FILE: src/Processing/EntitySplitterProcessor.php

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected EntityTypeManagerInterface $entityTypeManager;

  /**
   * The entity field manager.
   *
   * @var \Drupal\Core\Entity\EntityFieldManagerInterface
   */
  protected EntityFieldManagerInterface $entityFieldManager;

  /**
   * The module handler.
   *
   * @var \Drupal\Core\Extension\ModuleHandlerInterface
   */
  protected ModuleHandlerInterface $moduleHandler;

  /**
   * The queue.
   *
   * @var \Drupal\Core\Queue\QueueInterface
   */
  protected QueueInterface $queue;

  /**
   * The language manager.
   *
   * @var \Drupal\Core\Language\LanguageManagerInterface
   */
  protected LanguageManagerInterface $languageManager;

  /**
   * The logger.
   *
   * @var \Drupal\Core\Logger\LoggerChannelInterface
   */
  protected LoggerChannelInterface $logger;

  /**
   * Construct a processor.
   */
  public function __construct(
    EntityTypeManagerInterface $entity_type_manager,
    EntityFieldManagerInterface $entity_field_manager,
    ModuleHandlerInterface $module_handler,
    QueueFactory $queue_factory,
    LanguageManagerInterface $language_manager,
    LoggerChannelInterface $logger,
  ) {
    $this->entityTypeManager = $entity_type_manager;
    $this->entityFieldManager = $entity_field_manager;
    $this->moduleHandler = $module_handler;
    $this->queue = $queue_factory->get('entity_splitter_field_data_migration');
    $this->languageManager = $language_manager;
    $this->logger = $logger;
  }

New modules, which are compatible with Drupal 10 and higher versions are expected to include type declarations in property definitions, and use constructor property promotion.

remco hoeneveld’s picture

Thank you vishal.kadam will change these!

remco hoeneveld’s picture

I have made these changes! Thank you for the review.

remco hoeneveld’s picture

Status: Needs work » Needs review
vishal.kadam’s picture

Status: Needs review » Needs work

1 file change is pending

FILE: src/Plugin/EntitySplitterBase.php

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected EntityTypeManagerInterface $entityTypeManager;

  /**
   * The entity field manager.
   *
   * @var \Drupal\Core\Entity\EntityFieldManagerInterface
   */
  protected EntityFieldManagerInterface $entityFieldManager;

  /**
   * Generic processor that abstracts common migration steps.
   *
   * @var \Drupal\entity_splitter\Processing\EntitySplitterProcessor
   */
  protected EntitySplitterProcessor $processor;

  /**
   * The entity migration processor.
   *
   * @var \Drupal\entity_splitter\Processing\EntitySplitterProcessor
   */
  protected EntitySplitterProcessor $entitySplitterProcessor;

  /**
   * The logger.
   *
   * @var \Drupal\Core\Logger\LoggerChannelInterface
   */
  protected LoggerChannelInterface $logger;

  /**
   * Construct an entity migration base.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
   *   The entity field manager.
   * @param \Drupal\entity_splitter\Processing\EntitySplitterProcessor $entity_splitter_processor
   *   The entity migration processor.
   * @param \Drupal\Core\Logger\LoggerChannelInterface $logger
   *   The logger channel.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, EntitySplitterProcessor $entity_splitter_processor, LoggerChannelInterface $logger) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->entityTypeManager = $entity_type_manager;
    $this->entityFieldManager = $entity_field_manager;
    $this->entitySplitterProcessor = $entity_splitter_processor;
    $this->logger = $logger;
  }

New modules, which are compatible with Drupal 10 and higher versions are expected to include type declarations in property definitions, and use constructor property promotion.

remco hoeneveld’s picture

You're absolutely right my apologies! I've updated this file as well. Thank you for the thorough review.

vishal.kadam’s picture

Remember to change status, when the project is ready to be reviewed. In this queue, projects are only reviewed when the status is Needs review.

remco hoeneveld’s picture

Status: Needs work » Needs review
vishal.kadam’s picture

Status: Needs review » Reviewed & tested by the community

Rest looks good to me.

Please wait for a Project Moderator to take a look and if everything goes fine, you will get the role.

avpaderno’s picture

Assigned: Unassigned » avpaderno

Thank you for your contribution and for your patience with the review process!

I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.

These are some recommended readings to help you with maintainership:

You can find more contributors chatting on Slack or IRC in #drupal-contribute. So, come hang out and stay involved!
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

I thank also all the reviewers for helping with these applications.

avpaderno’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.