Fixed issue when one to one badly populated when containing null values. Fixed DDC-1548.
This commit is contained in:
parent
108cb53eef
commit
68663fac4b
@ -243,7 +243,7 @@ abstract class AbstractHydrator
|
||||
}
|
||||
|
||||
if (isset($cache[$key]['isMetaColumn'])) {
|
||||
if ( ! isset($rowData[$dqlAlias][$cache[$key]['fieldName']]) || $value !== null) {
|
||||
if ( ! isset($rowData[$dqlAlias][$cache[$key]['fieldName']]) && $value !== null) {
|
||||
$rowData[$dqlAlias][$cache[$key]['fieldName']] = $value;
|
||||
if ($cache[$key]['isIdentifier']) {
|
||||
$nonemptyComponents[$dqlAlias] = true;
|
||||
|
80
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1548Test.php
Normal file
80
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1548Test.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional\Ticket;
|
||||
|
||||
/**
|
||||
* @group DDC-1548
|
||||
*/
|
||||
class DDC1548Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->_schemaTool->createSchema(array(
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1548E1'),
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1548E2'),
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1548Rel'),
|
||||
));
|
||||
}
|
||||
|
||||
public function testIssue()
|
||||
{
|
||||
$rel = new DDC1548Rel();
|
||||
$this->_em->persist($rel);
|
||||
$this->_em->flush();
|
||||
|
||||
$e1 = new DDC1548E1();
|
||||
$e1->rel = $rel;
|
||||
$this->_em->persist($e1);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$obt = $this->_em->find(__NAMESPACE__ . '\DDC1548Rel', $rel->id);
|
||||
|
||||
$this->assertNull($obt->e2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class DDC1548E1
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @OneToOne(targetEntity="DDC1548Rel", inversedBy="e1")
|
||||
*/
|
||||
public $rel;
|
||||
}
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class DDC1548E2
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @OneToOne(targetEntity="DDC1548Rel", inversedBy="e2")
|
||||
*/
|
||||
public $rel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class DDC1548Rel
|
||||
{
|
||||
/**
|
||||
* @Id @GeneratedValue
|
||||
* @Column(type="integer")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="DDC1548E1", mappedBy="rel")
|
||||
*/
|
||||
public $e1;
|
||||
/**
|
||||
* @OneToOne(targetEntity="DDC1548E2", mappedBy="rel")
|
||||
*/
|
||||
public $e2;
|
||||
}
|
Loading…
Reference in New Issue
Block a user