|
4 | 4 |
|
5 | 5 | namespace AutoMapper\Extractor; |
6 | 6 |
|
7 | | -use AutoMapper\Attribute\MapIdentifier; |
8 | 7 | use AutoMapper\Configuration; |
9 | 8 | use AutoMapper\Event\PropertyMetadataEvent; |
10 | | -use AutoMapper\Metadata\TargetPropertyMetadata; |
11 | 9 | use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface; |
12 | 10 | use Symfony\Component\PropertyInfo\PropertyReadInfo; |
13 | 11 | use Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface; |
@@ -189,72 +187,4 @@ public function getDateTimeFormat(PropertyMetadataEvent $propertyMetadataEvent): |
189 | 187 |
|
190 | 188 | return $this->configuration->dateTimeFormat; |
191 | 189 | } |
192 | | - |
193 | | - public function isIdentifier(?\ReflectionClass $targetReflectionClass, TargetPropertyMetadata $target): bool |
194 | | - { |
195 | | - if ($targetReflectionClass === null) { |
196 | | - return false; |
197 | | - } |
198 | | - |
199 | | - // check on reflection property |
200 | | - if ($targetReflectionClass->hasProperty($target->property)) { |
201 | | - $reflectionProperty = $targetReflectionClass->getProperty($target->property); |
202 | | - |
203 | | - if (\count($reflectionProperty->getAttributes(MapIdentifier::class)) > 0) { |
204 | | - return true; |
205 | | - } |
206 | | - } |
207 | | - |
208 | | - // check on the getter to read, it may not be defined yet so we cannot skip this everytime |
209 | | - if ($target->readAccessor !== null) { |
210 | | - // check with read accessor on property |
211 | | - if ($target->readAccessor->type === ReadAccessor::TYPE_PROPERTY && $targetReflectionClass->hasProperty( |
212 | | - $target->readAccessor->property |
213 | | - )) { |
214 | | - $reflectionProperty = $targetReflectionClass->getProperty( |
215 | | - $target->readAccessor->property |
216 | | - ); |
217 | | - |
218 | | - if (\count($reflectionProperty->getAttributes(MapIdentifier::class)) > 0) { |
219 | | - return true; |
220 | | - } |
221 | | - } |
222 | | - |
223 | | - // check with read accessor on method |
224 | | - if ($target->readAccessor->type === ReadAccessor::TYPE_METHOD && $targetReflectionClass->hasMethod( |
225 | | - $target->readAccessor->property |
226 | | - )) { |
227 | | - $reflectionMethod = $targetReflectionClass->getMethod( |
228 | | - $target->readAccessor->property |
229 | | - ); |
230 | | - |
231 | | - if (\count($reflectionMethod->getAttributes(MapIdentifier::class)) > 0) { |
232 | | - return true; |
233 | | - } |
234 | | - } |
235 | | - } |
236 | | - |
237 | | - // same for the write mutator, we cannot globally skip this check as it may be defined latter |
238 | | - if ($target->writeMutator !== null) { |
239 | | - // check for property |
240 | | - if ($target->writeMutator->type === WriteMutator::TYPE_PROPERTY && $targetReflectionClass->hasProperty($target->writeMutator->property)) { |
241 | | - $reflectionProperty = $targetReflectionClass->getProperty( |
242 | | - $target->writeMutator->property |
243 | | - ); |
244 | | - |
245 | | - if (\count($reflectionProperty->getAttributes(MapIdentifier::class)) > 0) { |
246 | | - return true; |
247 | | - } |
248 | | - } |
249 | | - |
250 | | - // check for parameter in constructor |
251 | | - if ($target->writeMutator->type === WriteMutator::TYPE_CONSTRUCTOR && $target->writeMutator->parameter !== null) { |
252 | | - if (\count($target->writeMutator->parameter->getAttributes(MapIdentifier::class)) > 0) { |
253 | | - return true; |
254 | | - } |
255 | | - } |
256 | | - } |
257 | | - |
258 | | - return false; |
259 | | - } |
260 | 190 | } |
0 commit comments