Skip to content
Snippets Groups Projects

use ->getOriginal() instead of ->original

Open Patrick Kenny requested to merge issue/field_encrypt-3524315:get_original into 4.x
Files
4
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Drupal\field_encrypt\Entity;
use Drupal\Component\Utility\DeprecationHelper;
use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Entity\Attribute\ConfigEntityType;
use Drupal\Core\Entity\EntityStorageInterface;
@@ -117,7 +118,15 @@ class FieldEncryptEntityType extends ConfigEntityBase {
*/
public function postSave(EntityStorageInterface $storage, $update = TRUE): void {
parent::postSave($storage, $update);
if (!$update || $this->getBaseFields() !== $this->original->getBaseFields()) {
$original_entity = DeprecationHelper::backwardsCompatibleCall(
\Drupal::VERSION,
'11.2',
fn () => $this->getOriginal(),
fn () => $this->original,
);
if (!$update || $this->getBaseFields() !== $original_entity->getBaseFields()) {
self::queueEntityUpdates($this->id());
}
// Update the field_encrypt module's state.
Loading