diff --git a/app/Repositories/AssetType.php b/app/Repositories/AssetType.php index 42b71e0e..58ba35bc 100644 --- a/app/Repositories/AssetType.php +++ b/app/Repositories/AssetType.php @@ -59,7 +59,7 @@ public function isInUse(Entity $entity): bool ->getEntityManager() ->getRepository('Asset') ->select(['id']) - ->where(['type*' => '%"' . $entity->getFetched('name') . '"%']) + ->where(['type*' => '%"' . ($entity->isNew() ? $entity->get('name') : $entity->getFetched('name')) . '"%']) ->findOne(); return !empty($asset);