From 8c3bfed9c9608208d7a5c079102b0a95476c24fb Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Sun, 18 Jan 2026 21:48:44 +0100 Subject: [PATCH] Add `EntityModel::refresh()`. --- CHANGELOG.md | 6 ++++++ src/Model/EntityModel.php | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f61f8cf..e6448a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +3.4.2 +===== + +* (improvement) Add `EntityModel::refresh()`. + + 3.4.1 ===== diff --git a/src/Model/EntityModel.php b/src/Model/EntityModel.php index 79e7e80..a06e87e 100644 --- a/src/Model/EntityModel.php +++ b/src/Model/EntityModel.php @@ -65,7 +65,7 @@ public function persist (EntityInterface $entity) : static } /** - * @inheritDoc + * Flushes all database changes of all entities to the database */ public function flush () : static { @@ -73,4 +73,12 @@ public function flush () : static return $this; } + + /** + * Refreshes/resets the given entity: will reset the entity to the values currently stored in the database + */ + public function refresh (EntityInterface $entity) : void + { + $this->entityManager->refresh($entity); + } }