From 4fc7f0057c380537a70d6a0e1688d8779b5d0071 Mon Sep 17 00:00:00 2001 From: Vytautas Stankus Date: Fri, 18 Sep 2020 16:06:00 +0300 Subject: [PATCH] fixed: Calling Doctrine\ORM\EntityManager::flush() with any arguments to flush specific entities is deprecated and will not be supported in Doctrine ORM 3.0. --- CHANGELOG.md | 2 +- src/Storage/DoctrineStorage.php | 2 +- tests/Settings/Storage/DoctrineStorageTest.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b91779..7b379c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ All Notable changes to `svycka/sv-settings` will be documented in this file - Nothing ### Fixed -- Nothing +- [BC Break] Will call flush() on Doctrine entityManager without specific entity because it is deprecated ### Removed - Nothing diff --git a/src/Storage/DoctrineStorage.php b/src/Storage/DoctrineStorage.php index 8e3fde1..ac6070e 100644 --- a/src/Storage/DoctrineStorage.php +++ b/src/Storage/DoctrineStorage.php @@ -64,7 +64,7 @@ public function set(CollectionInterface $collection, $identifier, $name, $value) $setting->setValue($value); $this->entityManager->persist($setting); - $this->entityManager->flush($setting); + $this->entityManager->flush(); } /** diff --git a/tests/Settings/Storage/DoctrineStorageTest.php b/tests/Settings/Storage/DoctrineStorageTest.php index ef9eabe..5675d0a 100644 --- a/tests/Settings/Storage/DoctrineStorageTest.php +++ b/tests/Settings/Storage/DoctrineStorageTest.php @@ -55,7 +55,7 @@ function (SettingInterface $value) { ); $entityManager = $this->prophesize(EntityManagerInterface::class); $entityManager->persist($entity)->shouldBeCalled(); - $entityManager->flush($entity)->shouldBeCalled(); + $entityManager->flush()->shouldBeCalled(); $repository = $this->prophesize(ObjectRepository::class); $repository->findOneBy([ 'collection' => $this->collection->getOptions()->getName(), @@ -74,7 +74,7 @@ public function testCanUpdate() $setting->setValue($value = 'F')->shouldBeCalled(); $entityManager = $this->prophesize(EntityManagerInterface::class); $entityManager->persist($setting->reveal())->shouldBeCalled(); - $entityManager->flush($setting->reveal())->shouldBeCalled(); + $entityManager->flush()->shouldBeCalled(); $repository = $this->prophesize(ObjectRepository::class); $repository->findOneBy([