1 | <?php |
||
26 | final class Orm |
||
27 | { |
||
28 | |||
29 | /** |
||
30 | * @var MappersMap|EntityMapperInterface[] |
||
31 | */ |
||
32 | private $mappers; |
||
33 | |||
34 | /** |
||
35 | * @var Orm |
||
36 | */ |
||
37 | private static $instance; |
||
38 | |||
39 | /** |
||
40 | * @var AdaptersMap |
||
41 | */ |
||
42 | private $adapters; |
||
43 | |||
44 | /** |
||
45 | * Initialize Orm registry with empty lists |
||
46 | */ |
||
47 | 2 | private function __construct() |
|
52 | |||
53 | /** |
||
54 | * Avoid clone on a singleton |
||
55 | * @codeCoverageIgnore |
||
56 | */ |
||
57 | private function __clone() |
||
61 | |||
62 | /** |
||
63 | * Gets a ORM registry instance |
||
64 | * |
||
65 | * @return Orm |
||
66 | */ |
||
67 | 6 | public static function getInstance() |
|
74 | |||
75 | /** |
||
76 | * Retrieves the mapper for provided entity |
||
77 | * |
||
78 | * If mapper does not exists it will be created and stored in the |
||
79 | * mapper map. |
||
80 | * |
||
81 | * @param EntityInterface $entity |
||
82 | * @return EntityMapper |
||
83 | */ |
||
84 | 4 | public static function getMapper(EntityInterface $entity) |
|
88 | |||
89 | /** |
||
90 | * Gets repository for provided entity class name |
||
91 | * |
||
92 | * @param string $entityClass FQ entity class name |
||
93 | * |
||
94 | * @return EntityRepository |
||
95 | * |
||
96 | * @throws InvalidArgumentException If provide class name is not |
||
97 | * from a class that implements the EntityInterface interface. |
||
98 | */ |
||
99 | public static function getRepository($entityClass) |
||
103 | |||
104 | /** |
||
105 | * Gets repository for provided entity class name |
||
106 | * |
||
107 | * @param string $entityClass FQ entity class name |
||
108 | * |
||
109 | * @return EntityRepository |
||
110 | * |
||
111 | * @throws InvalidArgumentException If provide class name is not |
||
112 | * from a class that implements the EntityInterface interface. |
||
113 | */ |
||
114 | public function getRepositoryFor($entityClass) |
||
131 | |||
132 | /** |
||
133 | * Retrieves the mapper for provided entity |
||
134 | * |
||
135 | * If mapper does not exists it will be created and stored in the |
||
136 | * mapper map. |
||
137 | * |
||
138 | * @param string $entity |
||
139 | * @return EntityMapper |
||
140 | */ |
||
141 | 4 | public function getMapperFor($entity) |
|
147 | |||
148 | /** |
||
149 | * Sets default adapter |
||
150 | * |
||
151 | * @param AdapterInterface $adapter |
||
152 | * @return $this|Orm|self |
||
153 | */ |
||
154 | 6 | public function setDefaultAdapter(AdapterInterface $adapter) |
|
158 | |||
159 | /** |
||
160 | * Sets an adapter mapped with alias name |
||
161 | * |
||
162 | * @param string $alias |
||
163 | * @param AdapterInterface $adapter |
||
164 | * |
||
165 | * @return $this|Orm|self |
||
166 | */ |
||
167 | 6 | public function setAdapter($alias, AdapterInterface $adapter) |
|
172 | |||
173 | /** |
||
174 | * Creates entity map for provided entity |
||
175 | * |
||
176 | * @param string $entity |
||
177 | * @return EntityMapper |
||
178 | */ |
||
179 | 4 | private function createMapper($entity) |
|
190 | |||
191 | /** |
||
192 | * Gets the adapter alias for current working entity |
||
193 | * |
||
194 | * @param string $entity |
||
195 | * |
||
196 | * @return EntityDescriptor|string |
||
197 | */ |
||
198 | 4 | private function getAdapterAlias($entity) |
|
206 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: