2011-12-11 17:08:58 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\ORM\Functional\Ticket;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group DDC-1515
|
|
|
|
*/
|
|
|
|
class DDC1515Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|
|
|
{
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
2016-12-07 23:33:41 +01:00
|
|
|
$this->_schemaTool->createSchema(
|
|
|
|
[
|
2016-12-08 18:01:04 +01:00
|
|
|
$this->_em->getClassMetadata(DDC1515Foo::class),
|
|
|
|
$this->_em->getClassMetadata(DDC1515Bar::class),
|
2016-12-07 23:33:41 +01:00
|
|
|
]
|
|
|
|
);
|
2011-12-11 17:08:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2016-12-08 18:01:04 +01:00
|
|
|
$bar = $this->_em->find(DDC1515Bar::class, $bar->id);
|
|
|
|
$this->assertInstanceOf(DDC1515Foo::class, $bar->foo);
|
2011-12-11 17:08:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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;
|
|
|
|
}
|