1
0
mirror of synced 2024-12-13 22:56:04 +03:00

DDC-1515 - Now the real bugfix

This commit is contained in:
Benjamin Eberlei 2011-12-11 17:08:58 +01:00
parent f6d2b00d5c
commit 40d094fea2
2 changed files with 67 additions and 0 deletions

View File

@ -245,6 +245,9 @@ abstract class AbstractHydrator
if (isset($cache[$key]['isMetaColumn'])) {
if ( ! isset($rowData[$dqlAlias][$cache[$key]['fieldName']]) || $value !== null) {
$rowData[$dqlAlias][$cache[$key]['fieldName']] = $value;
if ($cache[$key]['isIdentifier']) {
$nonemptyComponents[$dqlAlias] = true;
}
}
continue;

View File

@ -0,0 +1,64 @@
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
/**
* @group DDC-1515
*/
class DDC1515Test extends \Doctrine\Tests\OrmFunctionalTestCase
{
public function setUp()
{
parent::setUp();
$this->_schemaTool->createSchema(array(
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1515Foo'),
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1515Bar'),
));
}
public function testIssue()
{
$bar = new DDC1515Bar();
$this->_em->persist($bar);
$this->_em->flush();
$foo = new DDC1515Foo();
$foo->bar = $bar;
$this->_em->persist($foo);
$this->_em->flush();
$this->_em->clear();
$bar = $this->_em->find(__NAMESPACE__ . '\DDC1515Bar', $bar->id);
$this->assertInstanceOf(__NAMESPACE__.'\DDC1515Foo', $bar->foo);
}
}
/**
* @Entity
*/
class DDC1515Foo
{
/**
* @OneToOne(targetEntity="DDC1515Bar", inversedBy="foo") @Id
*/
public $bar;
}
/**
* @Entity
*/
class DDC1515Bar
{
/**
* @Id @Column(type="integer") @GeneratedValue
*/
public $id;
/**
* @OneToOne(targetEntity="DDC1515Foo", mappedBy="bar")
*/
public $foo;
}