- last update
over 1 year ago Patch Failed to Apply - Status changed to Needs work
over 1 year ago 6:13pm 14 June 2023 - 🇮🇹Italy apaderno Brescia, 🇮🇹
- $schema->addIndex('message_digest', 'aggregate', ['timestamp', 'sent', 'notifier'], $spec); + $schema->addIndex('message_digest', 'aggregate', [ + 'timestamp', 'sent', 'notifier', + ], $spec);
Since this issue focused on removing any call to
t()
from classes, let's focus on that change. Otherwise, this becomes just another Fix the issues reported by phpcs issue. - First commit to issue fork.
- last update
over 1 year ago 36 pass, 1 fail - First commit to issue fork.
- last update
over 1 year ago 36 pass, 1 fail - Status changed to Needs review
over 1 year ago 8:01am 7 July 2023 - last update
over 1 year ago 37 pass - Status changed to Needs work
over 1 year ago 8:30am 7 July 2023 - 🇮🇹Italy apaderno Brescia, 🇮🇹
Test classes should not use translated strings. The last patch does not change the code for the
MessageDigestIntervalFormTest
class.
Also, since a MR has been used, it would be better to keep using that, instead of creating patches. - Assigned to nitin_lama
- last update
over 1 year ago 36 pass, 1 fail - Issue was unassigned.
- 🇮🇹Italy apaderno Brescia, 🇮🇹
+ /** + * MessageDigestIntervalListBuilder constructor. + * + * @param \Drupal\Core\StringTranslation\TranslationInterface $stringTranslation + * The string translation service. + */ + public function __construct(TranslationInterface $stringTranslation) { + $this->setStringTranslation($stringTranslation); + } + + /** + * {@inheritdoc} + */ + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { + $entity_type_manager = $container->get('entity_type.manager'); + return new static( + $entity_type, + $entity_type_manager->getStorage($entity_type->id()), + $entity_type_manager->getDefinitions() + ); + }
The correct code is similar to the following one.
/** * Constructs a new \Drupal\message_digest\MessageDigestIntervalListBuilder object. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. * @param \Drupal\Core\StringTranslation\TranslationInterface $stringTranslation * The string translation service. */ public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, TranslationInterface $string_translation) { parent::__construct($entity_type, $storage); $this->setStringTranslation($string_translation); } /** * {@inheritdoc} */ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static($entity_type, $container->get('entity_type.manager')->getStorage($entity_type->id()), $container->get('string_translation') ); }
Test classes should not use translated strings. I think that is what test classes in Drupal core do.
- Status changed to Needs review
over 1 year ago 1:29pm 7 July 2023 - last update
over 1 year ago 36 pass, 1 fail The last submitted patch, 21: 3145304-21.patch, failed testing. View results →
- First commit to issue fork.
- last update
about 1 year ago 37 pass - last update
about 1 year ago 37 pass - 🇺🇸United States bluegeek9
I updated src/Plugin/Notifier/DigestBase.php. On my local machine, the assert function was not throwing an exception.
I updated it to throw a InvalidDigestGroupingException, but now I am not sure if this is the best exception to throw.
- Merge request !22Issue #3145304 by bluegeek9: Remove t() calls from classes → (Merged) created by bluegeek9
-
bluegeek9 →
committed 9412322b on 8.x-1.x
Issue #3145304: Remove t() calls from classes
-
bluegeek9 →
committed 9412322b on 8.x-1.x
- Status changed to Fixed
4 months ago 8:16pm 20 September 2024 Automatically closed - issue fixed for 2 weeks with no activity.