From 9dff8cc3d6879e115b486963e82b089076e760db Mon Sep 17 00:00:00 2001 From: "r.ratsun" Date: Mon, 30 Jan 2023 17:47:04 +0200 Subject: [PATCH] . --- app/Services/Asset.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Services/Asset.php b/app/Services/Asset.php index 749a8e2..05616d8 100644 --- a/app/Services/Asset.php +++ b/app/Services/Asset.php @@ -135,10 +135,11 @@ public function createEntity($data) } if (!empty($asset = $this->getEntityManager()->getRepository('Asset')->where(['fileId' => $attachment->get('id')])->findOne())) { + $asset = $this->readEntity($asset->get('id')); if (property_exists($data, 'type') && $data->type !== $asset->get('type')) { throw new BadRequest(sprintf($this->translate('assetExistWithOtherType', 'exceptions', 'Asset'), $data->url)); } - return $this->readEntity($asset->get('id')); + return $asset; } $data->name = $attachment->get('name');