[DDC-1964] Fix issue with refresh and and object hydrator not setting field to null explicitly to override possible previous values.
This commit is contained in:
parent
fc4a07c2b3
commit
7c1235dedb
@ -448,6 +448,7 @@ class ObjectHydrator extends AbstractHydrator
|
|||||||
$this->_resultPointers[$dqlAlias] = $element;
|
$this->_resultPointers[$dqlAlias] = $element;
|
||||||
} else {
|
} else {
|
||||||
$this->_uow->setOriginalEntityProperty($oid, $relationField, null);
|
$this->_uow->setOriginalEntityProperty($oid, $relationField, null);
|
||||||
|
$reflField->setValue($parentObject, null);
|
||||||
}
|
}
|
||||||
// else leave $reflFieldValue null for single-valued associations
|
// else leave $reflFieldValue null for single-valued associations
|
||||||
} else {
|
} else {
|
||||||
|
@ -183,6 +183,9 @@ class OneToOneEagerLoadingTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-1946
|
||||||
|
*/
|
||||||
public function testEagerLoadingDoesNotBreakRefresh()
|
public function testEagerLoadingDoesNotBreakRefresh()
|
||||||
{
|
{
|
||||||
$train = new Train(new TrainOwner('Johannes'));
|
$train = new Train(new TrainOwner('Johannes'));
|
||||||
@ -195,7 +198,7 @@ class OneToOneEagerLoadingTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
|
|
||||||
$this->assertSame($train, $order->train);
|
$this->assertSame($train, $order->train);
|
||||||
$this->_em->refresh($order);
|
$this->_em->refresh($order);
|
||||||
$this->assertNull($order->train);
|
$this->assertTrue($order->train === null, "Train reference was not refreshed to NULL.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@ use Doctrine\ORM\Query;
|
|||||||
|
|
||||||
require_once __DIR__ . '/../../../TestInit.php';
|
require_once __DIR__ . '/../../../TestInit.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-371
|
||||||
|
*/
|
||||||
class DDC371Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
class DDC371Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
|
Loading…
Reference in New Issue
Block a user