Skip to content
Snippets Groups Projects
Commit 3e2e6e7d authored by Aaron Bauman's avatar Aaron Bauman
Browse files

get entity type id from the proper place

parent 790c5273
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment