diff --git a/modules/salesforce_mapping/src/MappedObjectStorage.php b/modules/salesforce_mapping/src/MappedObjectStorage.php index a6c75d1517cb080f58a42ea42ddc8ab1b904f6db..1a90b3a77cd90cea2d4569975b98a72b45303f03 100644 --- a/modules/salesforce_mapping/src/MappedObjectStorage.php +++ b/modules/salesforce_mapping/src/MappedObjectStorage.php @@ -53,7 +53,6 @@ class MappedObjectStorage extends ConfigEntityStorage { * {@inheritdoc} */ public function __construct($entity_type_id, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityManagerInterface $entity_manager) { - $this->entity_type_id = $entity_type_id; $entity_type = $entity_manager->getDefinition($entity_type_id); parent::__construct($entity_type, $config_factory, $uuid_service, $language_manager); } diff --git a/modules/salesforce_mapping/src/SalesforceMappingStorage.php b/modules/salesforce_mapping/src/SalesforceMappingStorage.php index 6e7ee44f2e544a34909a01ec23d3faa9908432f7..89a9a7042f83d45b4d6b8342ac4f6e675aec2d78 100644 --- a/modules/salesforce_mapping/src/SalesforceMappingStorage.php +++ b/modules/salesforce_mapping/src/SalesforceMappingStorage.php @@ -49,13 +49,10 @@ class MappedObjectStorage extends SqlContentEntityStorage { */ protected $entityManager; - private $entity_type_id; - /** * {@inheritdoc} */ public function __construct($entity_type_id, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityManagerInterface $entity_manager) { - $this->entity_type_id = $entity_type_id; $entity_type = $entity_manager->getDefinition($entity_type_id); parent::__construct($entity_type, $config_factory, $uuid_service, $language_manager); } diff --git a/modules/salesforce_mapping/src/ThrowsOnLoadTrait.php b/modules/salesforce_mapping/src/ThrowsOnLoadTrait.php index f70ef4171f1081bdfb2e385862b48c74e87ade02..013edf4fe6fd30846c1d57f113c69d97d176ded5 100644 --- a/modules/salesforce_mapping/src/ThrowsOnLoadTrait.php +++ b/modules/salesforce_mapping/src/ThrowsOnLoadTrait.php @@ -4,10 +4,11 @@ namespace Drupal\salesforce_mapping; use Drupal\salesforce\EntityNotFoundException; +/** + * This trait should be attached to an instance of EntityStorageInterface + */ trait ThrowsOnLoadTrait { - protected $entity_type_id; - /** * Returns entities for given ids or throws exception. * @@ -25,7 +26,7 @@ trait ThrowsOnLoadTrait { public function loadMultiple(array $ids = NULL) { $entities = parent::loadMultiple($values); if (empty($mappings)) { - throw new EntityNotFoundException($properties, $this->entity_type_id); + throw new EntityNotFoundException($properties, $this->getEntityTypeId()); } return $mappings; } @@ -47,7 +48,7 @@ trait ThrowsOnLoadTrait { public function loadByProperties(array $properties = []) { $entities = parent::loadByProperties($properties); if (empty($mappings)) { - throw new EntityNotFoundException($properties, $this->entity_type_id); + throw new EntityNotFoundException($properties, $this->getEntityTypeId()); } return $entities; }