Skip to content

Commit fa964bc

Browse files
committed
[make:entity] _em will be private in ORM 3.0
1 parent 4b994df commit fa964bc

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

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

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,21 @@ public function __construct(ManagerRegistry $registry)
1919
parent::__construct($registry, <?= $entity_class_name; ?>::class);
2020
}
2121

22-
/**
23-
* @throws ORMException
24-
* @throws OptimisticLockException
25-
*/
2622
public function add(<?= $entity_class_name ?> $entity, bool $flush = false): void
2723
{
28-
$this->_em->persist($entity);
24+
($em = $this->getEntityManager())->persist($entity);
25+
2926
if ($flush) {
30-
$this->_em->flush();
27+
$em->flush();
3128
}
3229
}
3330

34-
/**
35-
* @throws ORMException
36-
* @throws OptimisticLockException
37-
*/
3831
public function remove(<?= $entity_class_name ?> $entity, bool $flush = false): void
3932
{
40-
$this->_em->remove($entity);
33+
($em = $this->getEntityManager())->remove($entity);
34+
4135
if ($flush) {
42-
$this->_em->flush();
36+
$em->flush();
4337
}
4438
}
4539
<?php if ($include_example_comments): // When adding a new method without existing default comments, the blank line is automatically added.?>
@@ -56,8 +50,8 @@ public function upgradePassword(<?= sprintf('%s ', $password_upgrade_user_interf
5650
}
5751

5852
$user->setPassword($newHashedPassword);
59-
$this->_em->persist($user);
60-
$this->_em->flush();
53+
54+
$this->add($user, true);
6155
}
6256

6357
<?php endif ?>

0 commit comments

Comments
 (0)