From f6b291f7849554a2153fb35cf5f3e863562348a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Magrez?= Date: Mon, 30 Jan 2023 15:12:51 +0100 Subject: [PATCH] Update parameter on delete custom entity --- CHANGELOG.md | 5 +++++ Model/CustomEntityRepository.php | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4928e6b..fb8ac90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. +## [1.3.9] - 2023-01-30 +[1.3.9]: https://github.com/Smile-SA/magento2-module-custom-entity/compare/1.3.8...1.3.9 + +- Update parameter on delete custom entity + ## [1.3.8] - 2022-12-02 [1.3.8]: https://github.com/Smile-SA/magento2-module-custom-entity/compare/1.3.7...1.3.8 diff --git a/Model/CustomEntityRepository.php b/Model/CustomEntityRepository.php index 7d9c38a..e37e3ba 100644 --- a/Model/CustomEntityRepository.php +++ b/Model/CustomEntityRepository.php @@ -167,13 +167,12 @@ public function get($entityId, ?int $storeId = null, bool $forceReload = false): public function delete(CustomEntityInterface $entity): bool { try { - $entityId = $entity->getId(); - $this->customEntityResource->delete($entityId); + $this->customEntityResource->delete($entity); } catch (\Exception $e) { throw new StateException(__('Cannot delete entity with id %1', $entity->getId()), $e); } - unset($this->instances[$entityId]); + unset($this->instances[$entity->getId()]); return true; }