[1.0.x] External Entities Field Processors

Created on 22 May 2023, about 1 year ago
Updated 26 June 2023, 12 months ago

Sometimes when we integrate external entities with external APIs or databases that we cannot control, the data received does not always match the format expected by Drupal. A clear example can be dates, or URLs to internal files that need to be imported to Drupal to be able to show them.

This module allows generating different processors for these cases quickly and easily and with a fieldmapper to associate those processors to the appropriate fields of the external entity.

Project link

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

We want to provide an easy way to alter data coming from external sources into external entities, creating custom data processors.

📌 Task
Status

Fixed

Component

module

Created by

🇪🇸Spain Juanjol Navarra

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

Comments & Activities

  • Issue created by @Juanjol
  • 🇮🇳India vishal.kadam Mumbai

    Thank you for applying! Reviewers will review the project files, describing what needs to be changed.

    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.

    To reviewers: Please read How to review security advisory coverage applications , What to cover in an application review , and Drupal.org security advisory coverage application workflow .

    While this application is open, only the user who opened the application can make commits to the project used for the application.

    Reviewers only describe what needs to be changed; they don't provide patches to fix what reported in a review.

  • 🇮🇳India vishal.kadam Mumbai

    Fix phpcs issues.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml external_entities_field_processors/
    
    FILE: external_entities_field_processors/external_entities_field_processors.info.yml
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
     7 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
    --------------------------------------------------------------------------------
    
    
    FILE: external_entities_field_processors/README.md
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
      3 | WARNING | [ ] Line exceeds 80 characters; contains 109 characters
     25 | WARNING | [ ] Line exceeds 80 characters; contains 116 characters
     32 | WARNING | [ ] Line exceeds 80 characters; contains 184 characters
     47 | ERROR   | [x] Expected 1 newline at end of file; 0 found
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: external_entities_field_processors/src/FieldMapProcessor/FieldMapProcessorBase.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     9 | WARNING | [x] Unused use statement
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: external_entities_field_processors/src/FieldMapProcessor/FieldMapProcessorInterface.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     3 | ERROR | [x] There must be one blank line after the namespace declaration
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: external_entities_field_processors/src/Plugin/ExternalEntities/FieldMapper/FieldMapProcessorsMapper.php
    --------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     150 | ERROR | [x] Expected 1 blank line after function; 2 found
     153 | ERROR | [x] Expected 1 newline at end of file; 3 found
     153 | ERROR | [x] The closing brace for the class must have an empty line before it
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: external_entities_field_processors/src/Plugin/ExternalEntities/FieldMapProcessor/DateStringToTimestamp.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | WARNING | [x] Unused use statement
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
  • Status changed to Needs work about 1 year ago
  • 🇪🇸Spain Eduardo Morales Alberti Spain, 🇪🇺

    4. Add a composer file to require drupal/external_entities

    https://www.drupal.org/docs/develop/creating-modules/add-a-composerjson-...

    Here are some reasons for creating a composer.json file:

    • A module that uses a PHP library that is hosted on packagist.org, or that depends on other contributed modules from drupal.org, should have a composer.json file so that people downloading the module using Composer will automatically also install the dependencies.

    5. PHPStan

    wodby@php.container:/var/www/html $ ./vendor/bin/phpstan analyze web/modules/contrib/external_entities_field_processors
    Note: Using configuration file /var/www/html/phpstan.neon.
     6/6 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
    
     ------ ------------------------------------------------------------------------------------------------------------------------------------------------------- 
      Line   src/FieldMapProcessor/FieldMapProcessorBase.php                                                                                                        
     ------ ------------------------------------------------------------------------------------------------------------------------------------------------------- 
      80     Unsafe usage of new static().                                                                                                                          
             💡 See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static                                                                      
      114    Method Drupal\external_entities_field_processors\FieldMapProcessor\FieldMapProcessorBase::processData() should return array but returns array|string.  
     ------ ------------------------------------------------------------------------------------------------------------------------------------------------------- 
    
     ------ ---------------------------------------------------------------------------------- 
      Line   src/Plugin/ExternalEntities/FieldMapProcessor/DateStringToTimestamp.php           
     ------ ---------------------------------------------------------------------------------- 
      26     Parameter #1 $datetime of function strtotime expects string, array|string given.  
      26     Parameter #2 $timestamp of function date expects int|null, int|false given.       
     ------ ---------------------------------------------------------------------------------- 
    
     ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
      Line   src/Plugin/ExternalEntities/FieldMapper/FieldMapProcessorsMapper.php                                                                                                                                                                                            
     ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
      38     Property Drupal\external_entities_field_processors\Plugin\ExternalEntities\FieldMapper\FieldMapProcessorsMapper::$fieldMapProcessorManager (Drupal\external_entities_field_processors\FieldMapProcessor\FieldMapProcessorManager) does not accept object|null.  
      137    Call to an undefined method object::processData().                                                                                                                                                                                                              
      142    Parameter #1 $definition of method Drupal\Core\TypedData\TypedDataManagerInterface::create() expects Drupal\Core\TypedData\DataDefinitionInterface, Drupal\Core\TypedData\DataDefinitionInterface|null given.                                                   
     ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
    
                                                                                                                            
     [ERROR] Found 7 errors 
    
  • Status changed to Needs review about 1 year ago
  • 🇪🇸Spain Juanjol Navarra

    Thanks both by your review. All comments are fixed in 1.0.x branch, please review again!

  • 🇪🇸Spain Eduardo Morales Alberti Spain, 🇪🇺

    @juanjol the module requires a module that is not covered by the security team, so can be unsafe, I am not sure what is the protocol or if it is a question to treat here.

    External_entity

        "require": {
            "drupal/external_entity": "^2.0@alpha"
        },
    
  • 🇪🇸Spain Juanjol Navarra

    @eduardo-morales-alberti please review again, there was a typo in composer.json. External entities is covered by security team.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Even if a module dependency is not covered by the security advisory policy, that does not influence these applications.

  • Status changed to RTBC about 1 year ago
  • 🇪🇸Spain Eduardo Morales Alberti Spain, 🇪🇺

    Now seems right to me.

  • 🇪🇸Spain Juanjol Navarra

    Is there anything necessary for this issue to be approved or reviewed?

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

    Thank you for your contribution! I am going to update your account.

    These are some recommended readings to help with excellent maintainership:

    You can find more contributors chatting on the Slack #contribute channel. So, come hang out and stay involved .
    Thank you, also, 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 all the reviewers.

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

Production build 0.69.0 2024