Support from Acquia helps fund testing for Drupal Acquia logo

Comments

penyaskito created an issue. See original summary.

penyaskito’s picture

Issue tags: +Novice
aleevas’s picture

Status: Active » Needs review
FileSize
5.69 KB

Added a quick patch

penyaskito’s picture

Status: Needs review » Needs work

Alexey, thanks for looking at this!!!

  1. +++ b/lingotek.services.yml
    @@ -43,7 +43,7 @@ services:
    -    arguments: ['@lingotek', '@lingotek.language_locale_mapper', '@lingotek.configuration', '@lingotek.config_translation', '@entity_type.manager', '@language_manager', '@entity_field.manager']
    +    arguments: ['@lingotek', '@lingotek.language_locale_mapper', '@lingotek.configuration', '@lingotek.config_translation', '@entity_type.manager', '@language_manager', '@database', '@entity_field.manager']
    
    +++ b/src/LingotekContentTranslationService.php
    @@ -91,10 +99,12 @@ class LingotekContentTranslationService implements LingotekContentTranslationSer
    -  public function __construct(LingotekInterface $lingotek, LanguageLocaleMapperInterface $language_locale_mapper, LingotekConfigurationServiceInterface $lingotek_configuration, LingotekConfigTranslationServiceInterface $lingotek_config_translation, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, EntityFieldManagerInterface $entity_field_manager = NULL) {
    +  public function __construct(LingotekInterface $lingotek, LanguageLocaleMapperInterface $language_locale_mapper, LingotekConfigurationServiceInterface $lingotek_configuration, LingotekConfigTranslationServiceInterface $lingotek_config_translation, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, Connection $connection, EntityFieldManagerInterface $entity_field_manager = NULL) {
    

    Let's put @database as the last argument per backwards compatibility, and default to NULL.

  2. +++ b/src/LingotekContentTranslationService.php
    @@ -105,6 +115,7 @@ class LingotekContentTranslationService implements LingotekContentTranslationSer
           @trigger_error('The entity_field.manager service must be passed to LingotekContentTranslationService::__construct, it is required before Lingotek 9.x-1.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
           $entity_field_manager = \Drupal::service('entity_field.manager');
         }
    +    $this->connection = $connection;
         $this->entityFieldManager = $entity_field_manager;
    

    If $connection is null, trigger an error and assign it from the container as we do with $entity_field_manager.

aleevas’s picture

Status: Needs work » Needs review

You're welcome @penyaskito
Here is my next patch

aleevas’s picture

FileSize
5.89 KB
6.59 KB

I forgot to add patch itself :)

penyaskito’s picture

Great!

+++ b/src/LingotekContentTranslationService.php
@@ -105,7 +115,12 @@ class LingotekContentTranslationService implements LingotekContentTranslationSer
+      @trigger_error('The database service must be passed to LingotekContentTranslationService::__construct, it is required before Lingotek 9.x-1.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);

That's referencing a wrong change record (applies for entity_manager, not for this deprecation).
Please link to https://www.drupal.org/node/2993033

penyaskito’s picture

Status: Needs review » Needs work
aleevas’s picture

FileSize
5.89 KB
6.59 KB

I hope that I'm finally did it :)

penyaskito’s picture

Status: Needs work » Reviewed & tested by the community

You did!! Thanks a lot :-)

  • penyaskito committed 73177fe on 8.x-2.x authored by aleevas
    Issue #3067795 by aleevas: Replace deprecated usage of db_transaction
    
penyaskito’s picture

Status: Reviewed & tested by the community » Fixed

Committed 73177fe and pushed to 8.x-2.x. Thanks, Alexey!

Status: Fixed » Closed (fixed)

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