File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed
src/Symfony/Cmf/Component/Testing/Functional/DbManager Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Symfony \Cmf \Component \Testing \Functional \DbManager ;
4
+
5
+ use Symfony \Component \DependencyInjection \ContainerInterface ;
6
+
7
+ use Doctrine \Common \Persistence \ManagerRegistry ;
8
+ use Doctrine \Common \Persistence \ObjectManager ;
9
+
10
+ /**
11
+ * The DbManager for the Doctrine2 ORM.
12
+ *
13
+ * This manager needs the DoctrineBundle to work.
14
+ *
15
+ * @author Wouter J <[email protected] >
16
+ */
17
+ class ORM
18
+ {
19
+ /**
20
+ * @var ContainerInterface
21
+ */
22
+ protected $ container ;
23
+
24
+ /**
25
+ * @var ObjectManager
26
+ */
27
+ protected $ om ;
28
+
29
+ /**
30
+ * Constructor.
31
+ *
32
+ * @param ContainerInterface $container
33
+ */
34
+ public function __construct (ContainerInterface $ container )
35
+ {
36
+ $ this ->container = $ container ;
37
+ }
38
+
39
+ /**
40
+ * Gets the Doctrine ManagerRegistry
41
+ *
42
+ * @return ManagerRegistry
43
+ */
44
+ public function getRegistry ()
45
+ {
46
+ return $ this ->container ->get ('doctrine ' );
47
+ }
48
+
49
+ /**
50
+ * Gets the Doctrine ObjectManager
51
+ *
52
+ * @return ObjectManager
53
+ */
54
+ public function getOm ()
55
+ {
56
+ if (!$ this ->om ) {
57
+ $ this ->om = $ this ->getRegistry ()->getManager ();
58
+ }
59
+
60
+ return $ this ->om ;
61
+ }
62
+ }
You can’t perform that action at this time.
0 commit comments