3 namespace Doctrine\Tests\ORM\Functional\Ticket;
5 use Doctrine\Common\Collections\ArrayCollection;
6 use Doctrine\Tests\Models\CMS\CmsUser;
7 use Doctrine\Tests\Models\CMS\CmsGroup;
9 require_once __DIR__ . '/../../../TestInit.php';
11 class DDC1258Test extends \Doctrine\Tests\OrmFunctionalTestCase
13 public function setUp()
16 $this->_schemaTool->createSchema(array(
17 $this->_em->getClassMetadata(__NAMESPACE__ . '\TestEntity'),
18 $this->_em->getClassMetadata(__NAMESPACE__ . '\TestAdditionalEntity')
22 public function testIssue()
24 $testEntity = new TestEntity();
25 $testEntity->setValue(3);
26 $testEntity->setAdditional(new TestAdditionalEntity());
27 $this->_em->persist($testEntity);
31 // So here the value is 3
32 $this->assertEquals(3, $testEntity->getValue());
34 $test = $this->_em->getRepository(__NAMESPACE__ . '\TestEntity')->find(1);
39 // So here the value is 5
40 $this->assertEquals(5, $test->getValue());
42 // Get the additional entity
43 $additional = $test->getAdditional();
46 $this->assertEquals(5, $test->getValue());
48 // Force the proxy to load
49 $additional->getBool();
51 // The value should still be 5
52 $this->assertEquals(5, $test->getValue());
64 * @Column(type="integer")
65 * @GeneratedValue(strategy="AUTO")
69 * @Column(type="integer")
73 * @OneToOne(targetEntity="TestAdditionalEntity", inversedBy="entity", orphanRemoval=true, cascade={"persist", "remove"})
75 protected $additional;
77 public function getValue()
82 public function setValue($value)
84 $this->value = $value;
87 public function getAdditional()
89 return $this->additional;
92 public function setAdditional($additional)
94 $this->additional = $additional;
100 class TestAdditionalEntity
104 * @Column(type="integer")
105 * @GeneratedValue(strategy="AUTO")
109 * @OneToOne(targetEntity="TestEntity", mappedBy="additional")
113 * @Column(type="boolean")
117 public function __construct()
122 public function getBool()
127 public function setBool($bool)