Skip to content

Commit

Permalink
Fixed code duplicating
Browse files Browse the repository at this point in the history
  • Loading branch information
notrix committed Dec 19, 2017
1 parent e5ebbf7 commit d9142d2
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions lib/Doctrine/ODM/MongoDB/SchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,16 +615,7 @@ private function runShardCollectionCommand($documentName)
try {
$mapping = $class->getFieldMappingByDbFieldName($key);
if (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {
switch ($mapping['storeAs']) {
case ClassMetadataInfo::REFERENCE_STORE_AS_REF:
$key .= '.id';
break;

case ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF:
case ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF_WITH_DB:
$key .= '.$id';
break;
}
$key = ClassMetadataInfo::getReferenceFieldName($mapping['storeAs'], $key);
}
} catch (MappingException $exception) {
// Ignore hitting unmapped fields
Expand Down

0 comments on commit d9142d2

Please sign in to comment.