Skip to content

Commit

Permalink
GRKAS1-30: Given object is not an instance of the class this property…
Browse files Browse the repository at this point in the history
… was declared (#39)
  • Loading branch information
emishusta authored Jan 30, 2020
1 parent db2f814 commit 0c313a6
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions ImportExport/Strategy/ProductImportStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@ class ProductImportStrategy extends ProductStrategy
{
use ImportStrategyAwareHelperTrait;

/**
* @var array
*/
protected $subclassCache = [];

public function close()
{
$this->subclassCache = [];
$this->reflectionProperties = [];
$this->cachedEntities = [];
$this->cachedInverseSingleRelations = [];
Expand Down Expand Up @@ -216,19 +210,9 @@ protected function updateRelations($entity, array $itemData = null)
protected function importExistingEntity($entity, $existingEntity, $itemData = null, array $excludedFields = [])
{
// Existing enum values shouldn't be modified. Just added to entity (collection).
$entityClass = ClassUtils::getClass($entity);

if (true === isset($this->subclassCache[$entityClass]) && true === $this->subclassCache[$entityClass]) {
if (is_a($entity, AbstractEnumValue::class)) {
return;
}
if (false === isset($this->subclassCache[$entityClass])) {
$reflectionClass = new \ReflectionClass($entity);
$this->subclassCache[$entityClass] = $reflectionClass->isSubclassOf(AbstractEnumValue::class);

if (true === $this->subclassCache[$entityClass]) {
return;
}
}

parent::importExistingEntity($entity, $existingEntity, $itemData, $excludedFields);
}
Expand Down

0 comments on commit 0c313a6

Please sign in to comment.