Skip to content

Commit 96e0918

Browse files
committed
change signature method add/remove repository
1 parent 11cc24d commit 96e0918

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/Resources/skeleton/doctrine/Repository.tpl.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public function __construct(ManagerRegistry $registry)
2929
* @throws ORMException
3030
* @throws OptimisticLockException
3131
*/
32-
public function add(<?= $entity_class_name ?> $entity, bool $flush = true): void
32+
public function add(<?= $entity_class_name ?> $entity, bool $flush = false): void
3333
{
3434
$this->_em->persist($entity);
35-
if ($flush) {
35+
if (!$flush) {
3636
$this->_em->flush();
3737
}
3838
}
@@ -41,10 +41,10 @@ public function add(<?= $entity_class_name ?> $entity, bool $flush = true): void
4141
* @throws ORMException
4242
* @throws OptimisticLockException
4343
*/
44-
public function remove(<?= $entity_class_name ?> $entity, bool $flush = true): void
44+
public function remove(<?= $entity_class_name ?> $entity, bool $flush = false): void
4545
{
4646
$this->_em->remove($entity);
47-
if ($flush) {
47+
if (!$flush) {
4848
$this->_em->flush();
4949
}
5050
}

tests/Doctrine/fixtures/expected_xml/src/Repository/UserRepository.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ public function __construct(ManagerRegistry $registry)
2525
* @throws ORMException
2626
* @throws OptimisticLockException
2727
*/
28-
public function add(UserXml $entity, bool $flush = true): void
28+
public function add(UserXml $entity, bool $flush = false): void
2929
{
3030
$this->_em->persist($entity);
31-
if ($flush) {
31+
if (!$flush) {
3232
$this->_em->flush();
3333
}
3434
}
@@ -37,10 +37,10 @@ public function add(UserXml $entity, bool $flush = true): void
3737
* @throws ORMException
3838
* @throws OptimisticLockException
3939
*/
40-
public function remove(UserXml $entity, bool $flush = true): void
40+
public function remove(UserXml $entity, bool $flush = false): void
4141
{
4242
$this->_em->remove($entity);
43-
if ($flush) {
43+
if (!$flush) {
4444
$this->_em->flush();
4545
}
4646
}

tests/Doctrine/fixtures/expected_xml/src/Repository/XOtherRepository.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ public function __construct(ManagerRegistry $registry)
2525
* @throws ORMException
2626
* @throws OptimisticLockException
2727
*/
28-
public function add(XOther $entity, bool $flush = true): void
28+
public function add(XOther $entity, bool $flush = false): void
2929
{
3030
$this->_em->persist($entity);
31-
if ($flush) {
31+
if (!$flush) {
3232
$this->_em->flush();
3333
}
3434
}
@@ -37,10 +37,10 @@ public function add(XOther $entity, bool $flush = true): void
3737
* @throws ORMException
3838
* @throws OptimisticLockException
3939
*/
40-
public function remove(XOther $entity, bool $flush = true): void
40+
public function remove(XOther $entity, bool $flush = false): void
4141
{
4242
$this->_em->remove($entity);
43-
if ($flush) {
43+
if (!$flush) {
4444
$this->_em->flush();
4545
}
4646
}

0 commit comments

Comments
 (0)