Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Cron broken when they trying to encrypt existing data ( Using Queue worker ) .
Reason : i deleted the old data but Queue worker have their entityId , so the try to load that entity but they not exist and it through fatal error .
Solution : check Entity Exist or not .
error :
PHP Fatal error: Call to a member function getTranslationLanguage
s() on a non-object in /var/www/html/ttn-reimbursement/modules/contrib/field_encrypt/src/FieldEncryptProcessEntities.php on line 406
Comment | File | Size | Author |
---|---|---|---|
#5 | field_encrypt-2900641-5.patch | 1.34 KB | perarg |
#2 | field_encrypt-2900641-2.patch | 1002 bytes | Jitendra verma |
Comments
Comment #2
Jitendra verma CreditAttribution: Jitendra verma at TO THE NEW commentedComment #3
Jitendra verma CreditAttribution: Jitendra verma at TO THE NEW commentedComment #4
daggerhart CreditAttribution: daggerhart commentedI've run into this problem as well. Patch approach seems fine (testing that the entity can be loaded).
One very minor nitpick with the patch is defining variables for values that already exist in the $data variable. You could easily perform the entity existence check like this:
\Drupal::entityTypeManager()->getStorage($data['entity_type'])->load($data['entity_id']);
Regardless, this patch applies and works for me, marking as reviewed.
Comment #5
perarg CreditAttribution: perarg as a volunteer commentedIt doesn't seem to work in 8.7.x. The problem seems to be that some entities allow revisions and others don't. The solution to this is to check if the entity type allows revision so in that case the check should be with loadRevision(). Otherwise the load() function should be used to get the entity.
Here is a patch fixing things. I have included also, @daggerhart little tip.
Comment #7
maskedjellybean#5 works for me on 8.7.5! Thanks perarg!
Comment #8
ptmkenny CreditAttribution: ptmkenny commentedI'm closing this issue because this is fixed in 3.x; UpdateEntityEncryption.php already contains similar logic.