1 | <?php |
||
25 | class ClassMetadataFactory extends AbstractClassMetadataFactory |
||
26 | { |
||
27 | /** |
||
28 | * @var DocumentManager |
||
29 | */ |
||
30 | private $dm; |
||
31 | |||
32 | /** |
||
33 | * The used metadata driver. |
||
34 | * |
||
35 | * @var MappingDriver |
||
36 | */ |
||
37 | private $driver; |
||
38 | |||
39 | /** |
||
40 | * Creates a new factory instance that uses the given DocumentManager instance. |
||
41 | * |
||
42 | * @param DocumentManager $dm The DocumentManager instance |
||
43 | * @throws \RuntimeException |
||
44 | */ |
||
45 | public function __construct(DocumentManager $dm) |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonSuperclassParents) |
||
76 | |||
77 | /** |
||
78 | * Check for any possible shortcomings in the class: |
||
79 | * |
||
80 | * The class must have an identifier field unless it's an embedded document or mapped superclass. |
||
81 | */ |
||
82 | private function validateMapping(ClassMetadataInterface $class) |
||
88 | |||
89 | private function addFieldMapping(ClassMetadataInterface $class, ClassMetadataInterface $parent) |
||
107 | |||
108 | private function addIndexes(ClassMetadata $class, ClassMetadata $parent) |
||
112 | |||
113 | /** |
||
114 | * |
||
115 | * @param ClassMetadataInterface $class |
||
116 | * @param ClassMetadataInterface $parent |
||
117 | */ |
||
118 | private function addAssociationsMapping(ClassMetadataInterface $class, ClassMetadataInterface $parent) |
||
124 | |||
125 | /** |
||
126 | * {@inheritdoc} |
||
127 | */ |
||
128 | protected function getFqcnFromAlias($namespaceAlias, $simpleClassName) |
||
132 | |||
133 | /** |
||
134 | * Forces the factory to load the metadata of all classes known to the underlying |
||
135 | * mapping driver. |
||
136 | * |
||
137 | * @return array The ClassMetadata instances of all mapped classes. |
||
138 | */ |
||
139 | public function getAllMetadata() |
||
148 | |||
149 | /** |
||
150 | * Gets the class metadata descriptor for a class. |
||
151 | * |
||
152 | * @param string $className The name of the class. |
||
153 | * @return ClassMetadata |
||
154 | * @throws MappingException |
||
155 | */ |
||
156 | public function getMetadataFor($className) |
||
166 | |||
167 | /** |
||
168 | * Loads the metadata of the class in question and all it's ancestors whose metadata |
||
169 | * is still not loaded. |
||
170 | * |
||
171 | * @param string $className The name of the class for which the metadata should get loaded. |
||
172 | * @return array |
||
173 | * @throws MappingException |
||
174 | */ |
||
175 | protected function loadMetadata($className) |
||
182 | |||
183 | /** |
||
184 | * Creates a new ClassMetadata instance for the given class name. |
||
185 | * |
||
186 | * @param string $className |
||
187 | * @return ClassMetadata |
||
188 | */ |
||
189 | protected function newClassMetadataInstance($className) |
||
193 | |||
194 | /** |
||
195 | * {@inheritdoc} |
||
196 | */ |
||
197 | protected function getDriver() |
||
201 | |||
202 | /** |
||
203 | * {@inheritdoc} |
||
204 | */ |
||
205 | protected function initialize() |
||
209 | |||
210 | /** |
||
211 | * {@inheritdoc} |
||
212 | */ |
||
213 | protected function initializeReflection(ClassMetadataInterface $class, ReflectionService $reflService) |
||
217 | |||
218 | /** |
||
219 | * {@inheritdoc} |
||
220 | */ |
||
221 | protected function wakeupReflection(ClassMetadataInterface $class, ReflectionService $reflService) |
||
225 | |||
226 | /** |
||
227 | * {@inheritDoc} |
||
228 | */ |
||
229 | protected function isEntity(ClassMetadataInterface $class) |
||
233 | } |
||
234 |
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.