1
0
mirror of synced 2025-03-21 23:43:53 +03:00

#1172 - fixed minor CS issues (spacing)

This commit is contained in:
Marco Pivetta 2015-01-16 22:54:30 +01:00
parent 45e733eb60
commit 57ce6ccfcf

View File

@ -3319,10 +3319,10 @@ class UnitOfWork implements PropertyChangedListener
/**
* @param object $entity
* @param object $managedCopy
*
* @throws ORMException
* @throws OptimisticLockException
* @throws TransactionRequiredException
* @internal param ClassMetadata $class
*/
private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
{
@ -3330,13 +3330,16 @@ class UnitOfWork implements PropertyChangedListener
foreach ($class->reflClass->getProperties() as $prop) {
$name = $prop->name;
$prop->setAccessible(true);
if ( ! isset($class->associationMappings[$name])) {
if ( ! $class->isIdentifier($name)) {
$prop->setValue($managedCopy, $prop->getValue($entity));
}
} else {
$assoc2 = $class->associationMappings[$name];
if ($assoc2['type'] & ClassMetadata::TO_ONE) {
$other = $prop->getValue($entity);
if ($other === null) {
@ -3346,6 +3349,7 @@ class UnitOfWork implements PropertyChangedListener
// do not merge fields marked lazy that have not been fetched.
return;
}
if ( ! $assoc2['isCascadeMerge']) {
if ($this->getEntityState($other) === self::STATE_DETACHED) {
$targetClass = $this->em->getClassMetadata($assoc2['targetEntity']);
@ -3367,6 +3371,7 @@ class UnitOfWork implements PropertyChangedListener
}
} else {
$mergeCol = $prop->getValue($entity);
if ($mergeCol instanceof PersistentCollection && ! $mergeCol->isInitialized()) {
// do not merge fields marked lazy that have not been fetched.
// keep the lazy persistent collection of the managed copy.
@ -3374,6 +3379,7 @@ class UnitOfWork implements PropertyChangedListener
}
$managedCol = $prop->getValue($managedCopy);
if ( ! $managedCol) {
$managedCol = new PersistentCollection(
$this->em,
@ -3382,9 +3388,10 @@ class UnitOfWork implements PropertyChangedListener
);
$managedCol->setOwner($managedCopy, $assoc2);
$prop->setValue($managedCopy, $managedCol);
$oid = spl_object_hash($entity);
$this->originalEntityData[$oid][$name] = $managedCol;
$this->originalEntityData[spl_object_hash($entity)][$name] = $managedCol;
}
if ($assoc2['isCascadeMerge']) {
$managedCol->initialize();
@ -3393,8 +3400,9 @@ class UnitOfWork implements PropertyChangedListener
$managedCol->unwrap()->clear();
$managedCol->setDirty(true);
if ($assoc2['isOwningSide'] && $assoc2['type'] == ClassMetadata::MANY_TO_MANY && $class->isChangeTrackingNotify(
)
if ($assoc2['isOwningSide']
&& $assoc2['type'] == ClassMetadata::MANY_TO_MANY
&& $class->isChangeTrackingNotify()
) {
$this->scheduleForDirtyCheck($managedCopy);
}