From 96e0918470cfa6424cdb6860738e5fc7491d5fde Mon Sep 17 00:00:00 2001 From: JB-oclock Date: Sat, 2 Apr 2022 13:04:38 +0000 Subject: [PATCH 1/2] change signature method add/remove repository --- src/Resources/skeleton/doctrine/Repository.tpl.php | 8 ++++---- .../expected_xml/src/Repository/UserRepository.php | 8 ++++---- .../expected_xml/src/Repository/XOtherRepository.php | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Resources/skeleton/doctrine/Repository.tpl.php b/src/Resources/skeleton/doctrine/Repository.tpl.php index f06885cf6..d827fab08 100644 --- a/src/Resources/skeleton/doctrine/Repository.tpl.php +++ b/src/Resources/skeleton/doctrine/Repository.tpl.php @@ -29,10 +29,10 @@ public function __construct(ManagerRegistry $registry) * @throws ORMException * @throws OptimisticLockException */ - public function add( $entity, bool $flush = true): void + public function add( $entity, bool $flush = false): void { $this->_em->persist($entity); - if ($flush) { + if (!$flush) { $this->_em->flush(); } } @@ -41,10 +41,10 @@ public function add( $entity, bool $flush = true): void * @throws ORMException * @throws OptimisticLockException */ - public function remove( $entity, bool $flush = true): void + public function remove( $entity, bool $flush = false): void { $this->_em->remove($entity); - if ($flush) { + if (!$flush) { $this->_em->flush(); } } diff --git a/tests/Doctrine/fixtures/expected_xml/src/Repository/UserRepository.php b/tests/Doctrine/fixtures/expected_xml/src/Repository/UserRepository.php index 66414ec39..16d64c9b9 100644 --- a/tests/Doctrine/fixtures/expected_xml/src/Repository/UserRepository.php +++ b/tests/Doctrine/fixtures/expected_xml/src/Repository/UserRepository.php @@ -25,10 +25,10 @@ public function __construct(ManagerRegistry $registry) * @throws ORMException * @throws OptimisticLockException */ - public function add(UserXml $entity, bool $flush = true): void + public function add(UserXml $entity, bool $flush = false): void { $this->_em->persist($entity); - if ($flush) { + if (!$flush) { $this->_em->flush(); } } @@ -37,10 +37,10 @@ public function add(UserXml $entity, bool $flush = true): void * @throws ORMException * @throws OptimisticLockException */ - public function remove(UserXml $entity, bool $flush = true): void + public function remove(UserXml $entity, bool $flush = false): void { $this->_em->remove($entity); - if ($flush) { + if (!$flush) { $this->_em->flush(); } } diff --git a/tests/Doctrine/fixtures/expected_xml/src/Repository/XOtherRepository.php b/tests/Doctrine/fixtures/expected_xml/src/Repository/XOtherRepository.php index 2b7115ee3..353e39995 100644 --- a/tests/Doctrine/fixtures/expected_xml/src/Repository/XOtherRepository.php +++ b/tests/Doctrine/fixtures/expected_xml/src/Repository/XOtherRepository.php @@ -25,10 +25,10 @@ public function __construct(ManagerRegistry $registry) * @throws ORMException * @throws OptimisticLockException */ - public function add(XOther $entity, bool $flush = true): void + public function add(XOther $entity, bool $flush = false): void { $this->_em->persist($entity); - if ($flush) { + if (!$flush) { $this->_em->flush(); } } @@ -37,10 +37,10 @@ public function add(XOther $entity, bool $flush = true): void * @throws ORMException * @throws OptimisticLockException */ - public function remove(XOther $entity, bool $flush = true): void + public function remove(XOther $entity, bool $flush = false): void { $this->_em->remove($entity); - if ($flush) { + if (!$flush) { $this->_em->flush(); } } From c4036458551db804c90b4836796606ff27e5bba5 Mon Sep 17 00:00:00 2001 From: JB-oclock Date: Mon, 4 Apr 2022 08:00:54 +0000 Subject: [PATCH 2/2] mistake resolved --- src/Resources/skeleton/doctrine/Repository.tpl.php | 4 ++-- .../fixtures/expected_xml/src/Repository/UserRepository.php | 4 ++-- .../fixtures/expected_xml/src/Repository/XOtherRepository.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Resources/skeleton/doctrine/Repository.tpl.php b/src/Resources/skeleton/doctrine/Repository.tpl.php index d827fab08..3601ceab6 100644 --- a/src/Resources/skeleton/doctrine/Repository.tpl.php +++ b/src/Resources/skeleton/doctrine/Repository.tpl.php @@ -32,7 +32,7 @@ public function __construct(ManagerRegistry $registry) public function add( $entity, bool $flush = false): void { $this->_em->persist($entity); - if (!$flush) { + if ($flush) { $this->_em->flush(); } } @@ -44,7 +44,7 @@ public function add( $entity, bool $flush = false): voi public function remove( $entity, bool $flush = false): void { $this->_em->remove($entity); - if (!$flush) { + if ($flush) { $this->_em->flush(); } } diff --git a/tests/Doctrine/fixtures/expected_xml/src/Repository/UserRepository.php b/tests/Doctrine/fixtures/expected_xml/src/Repository/UserRepository.php index 16d64c9b9..871e1ab05 100644 --- a/tests/Doctrine/fixtures/expected_xml/src/Repository/UserRepository.php +++ b/tests/Doctrine/fixtures/expected_xml/src/Repository/UserRepository.php @@ -28,7 +28,7 @@ public function __construct(ManagerRegistry $registry) public function add(UserXml $entity, bool $flush = false): void { $this->_em->persist($entity); - if (!$flush) { + if ($flush) { $this->_em->flush(); } } @@ -40,7 +40,7 @@ public function add(UserXml $entity, bool $flush = false): void public function remove(UserXml $entity, bool $flush = false): void { $this->_em->remove($entity); - if (!$flush) { + if ($flush) { $this->_em->flush(); } } diff --git a/tests/Doctrine/fixtures/expected_xml/src/Repository/XOtherRepository.php b/tests/Doctrine/fixtures/expected_xml/src/Repository/XOtherRepository.php index 353e39995..a772b174e 100644 --- a/tests/Doctrine/fixtures/expected_xml/src/Repository/XOtherRepository.php +++ b/tests/Doctrine/fixtures/expected_xml/src/Repository/XOtherRepository.php @@ -28,7 +28,7 @@ public function __construct(ManagerRegistry $registry) public function add(XOther $entity, bool $flush = false): void { $this->_em->persist($entity); - if (!$flush) { + if ($flush) { $this->_em->flush(); } } @@ -40,7 +40,7 @@ public function add(XOther $entity, bool $flush = false): void public function remove(XOther $entity, bool $flush = false): void { $this->_em->remove($entity); - if (!$flush) { + if ($flush) { $this->_em->flush(); } }