1 | <?php |
||
33 | abstract class Doctrine2 extends Dao |
||
34 | { |
||
35 | /** |
||
36 | * @var \Doctrine\ORM\EntityManager The entity manager |
||
37 | */ |
||
38 | protected $manager; |
||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $entityName; |
||
43 | /** |
||
44 | * |
||
45 | * @var \Doctrine\ORM\EntityRepository The entity repository |
||
46 | */ |
||
47 | protected $repository; |
||
48 | |||
49 | /** |
||
50 | * Creates a new MongoDB DAO. |
||
51 | * |
||
52 | * @param \Doctrine\ORM\EntityManager $manager The entity manager |
||
53 | * @param string $entityName The entity name |
||
54 | * @param \Psr\Log\LoggerInterface $logger A logger |
||
55 | */ |
||
56 | 4 | public function __construct(EntityManager $manager, string $entityName, \Psr\Log\LoggerInterface $logger = null) |
|
63 | |||
64 | /** |
||
65 | * Executes something in the context of the entityManager. |
||
66 | * |
||
67 | * Exceptions are caught and translated. |
||
68 | * |
||
69 | * @param Closure $cb The closure to execute, takes the entityManager |
||
70 | * @return mixed whatever the function returns, this method also returns |
||
71 | * @throws \Caridea\Dao\Exception If a database problem occurs |
||
72 | * @see \Caridea\Dao\Exception\Translator\Doctrine |
||
73 | */ |
||
74 | 2 | protected function doExecute(\Closure $cb) |
|
82 | |||
83 | /** |
||
84 | * Executes something in the context of the entityRepository. |
||
85 | * |
||
86 | * Exceptions are caught and translated. |
||
87 | * |
||
88 | * @param Closure $cb The closure to execute, takes the entityRepository |
||
89 | * @return mixed whatever the function returns, this method also returns |
||
90 | * @throws \Caridea\Dao\Exception If a database problem occurs |
||
91 | * @see \Caridea\Dao\Exception\Translator\Doctrine |
||
92 | */ |
||
93 | 2 | protected function doExecuteInRepository(\Closure $cb) |
|
101 | } |
||
102 |