1
0
mirror of synced 2024-12-05 03:06:05 +03:00

#1113 - minor CS fixes (spacing/alignment)

This commit is contained in:
Marco Pivetta 2015-02-16 01:02:56 +00:00
parent 8eea7c86f7
commit 2a99d5a19b
4 changed files with 29 additions and 11 deletions

View File

@ -1650,15 +1650,18 @@ class BasicEntityPersister implements EntityPersister
// Many-To-Many requires join table check for joinColumn
$columns = array();
$class = $this->class;
if ($association['type'] === ClassMetadata::MANY_TO_MANY) {
if ( ! $association['isOwningSide']) {
$association = $assoc;
}
$joinTableName = $this->quoteStrategy->getJoinTableName($association, $class, $this->platform);
$joinColumns = $assoc['isOwningSide']
? $association['joinTable']['joinColumns']
: $association['joinTable']['inverseJoinColumns'];
$joinTableName = $this->quoteStrategy->getJoinTableName($association, $class, $this->platform);
foreach ($joinColumns as $joinColumn) {
$columns[] = $joinTableName . '.' . $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform);
}
@ -1691,7 +1694,6 @@ class BasicEntityPersister implements EntityPersister
throw ORMException::unrecognizedField($field);
}
/**
* Gets the conditional SQL fragment used in the WHERE clause when selecting
* entities in this persister.
@ -1812,6 +1814,7 @@ class BasicEntityPersister implements EntityPersister
$types = array_merge($types, $this->getTypes($field, $value, $this->class));
$params = array_merge($params, $this->getValues($value));
}
return array($params, $types);
}
@ -1840,6 +1843,7 @@ class BasicEntityPersister implements EntityPersister
$types = array_merge($types, $this->getTypes($criterion['field'], $criterion['value'], $criterion['class']));
$params = array_merge($params, $this->getValues($criterion['value']));
}
return array($params, $types);
}
@ -1861,10 +1865,12 @@ class BasicEntityPersister implements EntityPersister
case (isset($class->fieldMappings[$field])):
$types = array_merge($types, PersisterHelper::getTypeOfField($field, $class, $this->em));
break;
case (isset($class->associationMappings[$field])):
$assoc = $class->associationMappings[$field];
$class = $this->em->getClassMetadata($assoc['targetEntity']);
if (!$assoc['isOwningSide']) {
if (! $assoc['isOwningSide']) {
$assoc = $class->associationMappings[$assoc['mappedBy']];
$class = $this->em->getClassMetadata($assoc['targetEntity']);
}
@ -1872,6 +1878,7 @@ class BasicEntityPersister implements EntityPersister
$columns = $assoc['type'] === ClassMetadata::MANY_TO_MANY
? $assoc['relationToTargetKeyColumns']
: $assoc['sourceToTargetKeyColumns'];
foreach ($columns as $column){
$types[] = PersisterHelper::getTypeOfColumn($column, $class, $this->em);
}
@ -1883,11 +1890,14 @@ class BasicEntityPersister implements EntityPersister
}
if (is_array($value)) {
$types = array_map(function ($type) {
$type = Type::getType($type)->getBindingType();
return $type + Connection::ARRAY_PARAM_OFFSET;
}, $types);
return array_map(
function ($type) {
return Type::getType($type)->getBindingType() + Connection::ARRAY_PARAM_OFFSET;
},
$types
);
}
return $types;
}
@ -1914,6 +1924,7 @@ class BasicEntityPersister implements EntityPersister
$class = $this->em->getClassMetadata(get_class($value));
if ($class->isIdentifierComposite) {
$newValue = array();
foreach ($class->getIdentifierValues($value) as $innerValue) {
$newValue = array_merge($newValue, $this->getValues($innerValue));
}

View File

@ -2629,7 +2629,9 @@ class UnitOfWork implements PropertyChangedListener
} else {
$associatedId[$targetClass->fieldNames[$targetColumn]] = $joinColumnValue;
}
} elseif ($targetClass->containsForeignIdentifier && in_array($targetClass->getFieldForColumn($targetColumn), $targetClass->identifier, true)) {
} elseif ($targetClass->containsForeignIdentifier
&& in_array($targetClass->getFieldForColumn($targetColumn), $targetClass->identifier, true)
) {
// the missing key is part of target's entity primary key
$associatedId = array();
break;

View File

@ -73,6 +73,7 @@ final class IdentifierFlattener
foreach ($class->identifier as $field) {
if (isset($class->associationMappings[$field]) && isset($id[$field]) && is_object($id[$field])) {
/* @var $targetClassMetadata ClassMetadata */
$targetClassMetadata = $this->metadataFactory->getMetadataFor(
$class->associationMappings[$field]['targetEntity']
);
@ -86,9 +87,11 @@ final class IdentifierFlattener
$flatId[$field] = implode(' ', $associatedId);
} elseif (isset($class->associationMappings[$field])) {
$associatedId = array();
foreach ($class->associationMappings[$field]['joinColumns'] as $joinColumn) {
$associatedId[] = $id[$joinColumn['name']];
}
$flatId[$field] = implode(' ', $associatedId);
} else {
$flatId[$field] = $id[$field];

View File

@ -68,9 +68,11 @@ class PersisterHelper
$types = array();
$targetClass = $em->getClassMetadata($assoc['targetEntity']);
foreach ($joinData['joinColumns'] as $joinColumn) {
$types[] = self::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $em);
}
return $types;
}