1 | <?php |
||
42 | class ClassMetadataFactory extends AbstractClassMetadataFactory |
||
43 | { |
||
44 | /** |
||
45 | * @var DocumentManager |
||
46 | */ |
||
47 | private $dm; |
||
48 | |||
49 | /** |
||
50 | * The used metadata driver. |
||
51 | * |
||
52 | * @var MappingDriver |
||
53 | */ |
||
54 | private $driver; |
||
55 | |||
56 | /** |
||
57 | * Creates a new factory instance that uses the given DocumentManager instance. |
||
58 | * |
||
59 | * @param DocumentManager $dm The DocumentManager instance |
||
60 | * @throws \RuntimeException |
||
61 | */ |
||
62 | public function __construct(DocumentManager $dm) |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonSuperclassParents) |
||
93 | |||
94 | /** |
||
95 | * Check for any possible shortcomings in the class: |
||
96 | * |
||
97 | * The class must have an identifier field unless it's an embedded document or mapped superclass. |
||
98 | */ |
||
99 | private function validateMapping(ClassMetadataInterface $class) |
||
105 | |||
106 | private function addFieldMapping(ClassMetadataInterface $class, ClassMetadataInterface $parent) |
||
124 | |||
125 | private function addIndexes(ClassMetadata $class, ClassMetadata $parent) |
||
129 | |||
130 | /** |
||
131 | * |
||
132 | * @param ClassMetadataInterface $class |
||
133 | * @param ClassMetadataInterface $parent |
||
134 | */ |
||
135 | private function addAssociationsMapping(ClassMetadataInterface $class, ClassMetadataInterface $parent) |
||
141 | |||
142 | /** |
||
143 | * {@inheritdoc} |
||
144 | */ |
||
145 | protected function getFqcnFromAlias($namespaceAlias, $simpleClassName) |
||
149 | |||
150 | /** |
||
151 | * Forces the factory to load the metadata of all classes known to the underlying |
||
152 | * mapping driver. |
||
153 | * |
||
154 | * @return array The ClassMetadata instances of all mapped classes. |
||
155 | */ |
||
156 | public function getAllMetadata() |
||
165 | |||
166 | /** |
||
167 | * Gets the class metadata descriptor for a class. |
||
168 | * |
||
169 | * @param string $className The name of the class. |
||
170 | * @return ClassMetadata |
||
171 | * @throws MappingException |
||
172 | */ |
||
173 | public function getMetadataFor($className) |
||
183 | |||
184 | /** |
||
185 | * Loads the metadata of the class in question and all it's ancestors whose metadata |
||
186 | * is still not loaded. |
||
187 | * |
||
188 | * @param string $className The name of the class for which the metadata should get loaded. |
||
189 | * @return array |
||
190 | * @throws MappingException |
||
191 | */ |
||
192 | protected function loadMetadata($className) |
||
199 | |||
200 | /** |
||
201 | * Creates a new ClassMetadata instance for the given class name. |
||
202 | * |
||
203 | * @param string $className |
||
204 | * @return ClassMetadata |
||
205 | */ |
||
206 | protected function newClassMetadataInstance($className) |
||
210 | |||
211 | /** |
||
212 | * {@inheritdoc} |
||
213 | */ |
||
214 | protected function getDriver() |
||
218 | |||
219 | /** |
||
220 | * {@inheritdoc} |
||
221 | */ |
||
222 | protected function initialize() |
||
226 | |||
227 | /** |
||
228 | * {@inheritdoc} |
||
229 | */ |
||
230 | protected function initializeReflection(ClassMetadataInterface $class, ReflectionService $reflService) |
||
234 | |||
235 | /** |
||
236 | * {@inheritdoc} |
||
237 | */ |
||
238 | protected function wakeupReflection(ClassMetadataInterface $class, ReflectionService $reflService) |
||
242 | |||
243 | /** |
||
244 | * {@inheritDoc} |
||
245 | */ |
||
246 | protected function isEntity(ClassMetadataInterface $class) |
||
250 | } |
||
251 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.