[1.x] Entity Value Inheritance

Created on 1 February 2024, 5 months ago
Updated 23 May 2024, about 1 month ago

This module currently allows for a source and destination of data at the field level. The purpose that is if someone has an entity in a hierarchy that provides data down to other referencing entity types it allows the data to sync upon update.

Example Node A has a Fields A, Fields B, and Field C. Node B references Node A and has Field D, Field E, and Field F. The idea is that Field F is to stay in sync with Field A. Upon saving Node A it updates Node B.

The current and main branch is the 1.x branch

Project link

https://www.drupal.org/project/entity_value_inheritance →

📌 Task
Status

Fixed

Component

module

Created by

🇺🇸United States sean_e_dietrich Sacramento, CA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sean_e_dietrich
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    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.

    • If you have not done it yet, you should run phpcs --standard=Drupal,>DrupalPractice on the project, which alone fixes most of what reviewers would report.
    • For the time this application is open, only your commits are allowed.
    • 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 will not be changed by this application; no other user will be able to opt projects into security advisory policy.
    • 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 branch to review and the project name.

    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, even to leave a comment similar to the following one. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
    • It is also preferable to wait before using a CLI tool → to report what needs to be changed, especially because the comment left from Code Review Administrators suggests to use PHP_CodeSniffer. Before that, manual reviews should be done.
    • Reviewers should not copy-paste the output of a CLI tool. They should use a CLI tool only once per application. When they do that, they should later verify the code has been correctly changed; this means, for example, that adding a documentation comment that is not correct just to avoid to get a warning/error is not a correct change that should be reported in a further comment.
    • 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 → .

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    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.

  • 🇮🇳India vishal.kadam Mumbai
  • Status changed to Needs review 5 months ago
  • 🇺🇸United States sean_e_dietrich Sacramento, CA

    I have read the following and have confirmed that Drupal Standards are being applied to the code.

  • Status changed to Needs work 4 months ago
  • 🇮🇳India vishal.kadam Mumbai

    1. Fix phpcs issues.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml entity_value_i
    nheritance/
    
    FILE: entity_value_inheritance/src/EntityValueInheritanceUpdaterPluginBase.php                         
    -------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE                                                                                                         
    -------------------------------------------------------------------------------
     240 | ERROR | The array declaration extends to column 142 (the limit is 80). The array content should be split up over multiple lines 
    -------------------------------------------------------------------------------
    
    
    FILE: entity_value_inheritance/tests/src/Functional/EntityValueInheritanceTestBase.php                 
    -------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES                                                                                                       
    -------------------------------------------------------------------------------
     24 | ERROR | The array declaration extends to column 91 (the limit is 80). The array content should be split up over multiple lines   
     38 | ERROR | The array declaration extends to column 101 (the limit is 80). The array content should be split up over multiple lines  
    -------------------------------------------------------------------------------
    
    
    FILE: entity_value_inheritance/tests/src/Kernel/EntityValueInheritanceTestBase.php
    -------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------
     33 | ERROR | The array declaration extends to column 112 (the limit is 80). The array content should be split up over multiple lines
    -------------------------------------------------------------------------------
    

    2. FILE: src/EntityValueInheritanceUpdaterPluginBase.php

      public function __construct(
        array $configuration,
        $plugin_id,
        $plugin_definition,
        EventDispatcherInterface $eventDispatcher,
        Helper $helper
      ) {
      public function updateDestination(
        EntityInterface $sourceEntity,
        EntityInterface $destinationEntity
      ): bool {
      public function alterForm(
        array $form,
        FormStateInterface $formState,
        EntityInterface $entity,
        FieldDefinitionInterface $fieldDefinition
      ): array {
      public function alterFormField(
        array $element,
        FormStateInterface $formState,
        EntityInterface $entity,
        FieldDefinitionInterface $fieldDefinition
      ): array {

    FILE: src/EntityValueInheritanceUpdaterPluginInterface.php

      public function updateDestination(
        EntityInterface $sourceEntity,
        EntityInterface $destinationEntity
      ): bool;
      public function alterForm(
        array $form,
        FormStateInterface $formState,
        EntityInterface $entity,
        FieldDefinitionInterface $fieldDefinition
      ): array;
      public function alterFormField(
        array $element,
        FormStateInterface $formState,
        EntityInterface $entity,
        FieldDefinitionInterface $fieldDefinition
      ): array;

    FILE: src/EntityValueInheritanceUpdaterPluginManager.php

      public function __construct(
        \Traversable $namespaces,
        CacheBackendInterface $cacheBackend,
        ModuleHandlerInterface $moduleHandler,
      ) {

    FILE: src/Services/Helper.php

      public function __construct(
        FieldTypePluginManagerInterface $fieldTypePluginManager,
        EntityTypeManagerInterface $entityTypeManager,
        EntityTypeBundleInfoInterface $entityTypeBundleInfo,
        EntityFieldManagerInterface $entityFieldManager,
        ModuleHandlerInterface $moduleHandler,
        EntityValueInheritanceUpdaterPluginManager $entityValueInheritanceUpdaterPluginManager,
        LoggerInterface $logger,
        EventDispatcherInterface $eventDispatcher
      ) {
      public function queryEntities(
        string $entity_type,
        array $inheritances,
        EntityInterface $refEntity
      ): array {
      public function getDestinationsByField(
        string $entityType,
        string $bundleType,
        string $field,
        string $fieldName = 'destination_entity_field'
      ): array {

    FILE: src/Services/InheritanceUpdater.php

      public function __construct(
        EntityValueInheritanceUpdaterPluginManager $pluginManager,
        Helper $helper
      ) {
      protected function updateEntity(
        InheritanceInterface $inheritance,
        EntityInterface $sourceEntity,
        EntityInterface $destinationEntity
      ): bool {
      protected function getListOfDestinationEntities(
        EntityInterface $sourceEntity,
        string $destinationEntityType,
        array $inheritances
      ): array {
      protected function tryUpdating(
        InheritanceInterface $inheritance,
        EntityInterface $sourceEntity,
        EntityInterface $destinationEntity
      ): EntityInterface {

    FILE: src/Plugin/EntityValueInheritanceUpdater/InheritanceOverridePlugin.php

      public function alterForm(
        array $form,
        FormStateInterface $formState,
        EntityInterface $entity,
        FieldDefinitionInterface $fieldDefinition
      ): array {
      public function alterFormField(
        array $element,
        FormStateInterface $formState,
        EntityInterface $entity,
        FieldDefinitionInterface $fieldDefinition
      ): array {
      public function preSaveEntity(
        EntityInterface $entity
      ): void {

    FILE: src/Plugin/EntityValueInheritanceUpdater/InheritanceUpdatePlugin.php

      public function updateDestination(
        EntityInterface $sourceEntity,
        EntityInterface $destinationEntity
      ): bool {

    FILE: src/Event/InheritanceSaveEntityEvent.php

      public function __construct(
        array $inheritances,
        array $destinationEntities = []
      ) {

    FILE: src/Event/InheritanceAlterFieldEvent.php

      public function __construct(
        protected array $element,
        protected string $message,
        protected InheritanceInterface $inheritance,
        protected EntityInterface $entity,
        protected FieldDefinitionInterface $fieldDefinition,
        protected FormStateInterface $formState
      ) {

    FILE: src/Event/InheritanceBaseEvent.php

      public function __construct(
        InheritanceInterface $inheritance,
        EntityInterface $sourceEntity,
        EntityInterface $destinationEntity
      ) {

    Function and method declarations are written on a single line.

    3. FILE: src/EntityValueInheritanceUpdaterPluginManager.php

      /**
       * Creates the discovery object.
       */
      public function __construct(

    FILE: src/Services/Helper.php

      /**
       * Constructor.
       */
      public function __construct(

    FILE: src/Services/InheritanceUpdater.php

      /**
       * Constructor.
       *
       * @param \Drupal\entity_value_inheritance\EntityValueInheritanceUpdaterPluginManager $pluginManager
       *   Entity Value Inheritance Updater Plugin Manager Service.
       * @param \Drupal\entity_value_inheritance\Services\Helper $helper
       *   Helper Class Service.
       */
      public function __construct(

    FILE:src/EventSubscriber/EventSubscriberBase.php

      /**
       * Constructor.
       */
      public function __construct(Helper $helper) {

    FILE: src/Event/InheritanceSaveEntityEvent.php

      /**
       * Constructor.
       */
      public function __construct(

    FILE: src/Event/InheritanceAlterFieldEvent.php

      /**
       * Constructor.
       */
      public function __construct(

    FILE: src/Event/InheritanceAlterUpdateListEvent.php

      /**
       * Constructor.
       */
      public function __construct(EntityInterface $sourceEntity, array $destinationList) {

    FILE: src/Event/InheritanceBaseEvent.php

      /**
       * Constructor.
       *
       * @param \Drupal\entity_value_inheritance\Entity\InheritanceInterface $inheritance
       *   Inheritance configuration.
       * @param \Drupal\Core\Entity\EntityInterface $sourceEntity
       *   Entity providing the information.
       * @param \Drupal\Core\Entity\EntityInterface $destinationEntity
       *   Entity being updated.
       */
      public function __construct(

    The documentation comment for constructors is not mandatory anymore, If it is given, the description must be Constructs a new [class name] object. where [class name] includes the class namespace.

  • Status changed to Needs review 4 months ago
  • 🇺🇸United States sean_e_dietrich Sacramento, CA

    Thank you for your help and your review. I have made the necessary changes and fixes.

    I will say that I was a bit confused on the constructor messaging so if you could take a look and let me know if what I did was correct or not. If not, if you have an example you could show that would be amazing.

  • 🇮🇳India vishal.kadam Mumbai

    You can find an example of a constructor documentation comment in Drupal core.

    For example: https://git.drupalcode.org/project/drupal/-/blob/10.3.x/core/modules/vie...

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    A better example is FormController::__construct(), where the class name includes the class namespace.

  • 🇺🇸United States sean_e_dietrich Sacramento, CA

    Thank you for the examples. I went ahead and modeled my constructor comments after those.

  • 🇺🇸United States sean_e_dietrich Sacramento, CA

    Following up. Is there anything else I need to do for this?

  • Status changed to RTBC about 2 months ago
  • 🇮🇳India vishal.kadam Mumbai

    Rest looks fine to me.

    Let’s wait for a Code Review Administrator to take a look and if everything goes fine, you will get the role.

  • Assigned to apaderno
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Thank you for your contribution!
    I updated your account so you can now opt into security advisory coverage for any project you created and every project you will create.

    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 → !

    Thank you for your patience with the review process. 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 the dedicated reviewers as well.

  • Status changed to Fixed about 2 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024