3 namespace Doctrine\Tests\ORM\Functional\Ticket;
5 use Doctrine\Common\Collections\ArrayCollection;
6 use Doctrine\Tests\Models\CMS\CmsEmployee;
8 require_once __DIR__ . '/../../../TestInit.php';
13 class DDC1238Test extends \Doctrine\Tests\OrmFunctionalTestCase
15 public function setUp()
19 $this->_schemaTool->createSchema(array(
20 $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1238User'),
22 } catch(\Exception $e) {
27 public function testIssue()
29 $user = new DDC1238User;
30 $user->setName("test");
32 $this->_em->persist($user);
36 $userId = $user->getId();
39 $user = $this->_em->getReference(__NAMESPACE__ . '\\DDC1238User', $userId);
42 $userId2 = $user->getId();
43 $this->assertEquals($userId, $userId2, "This proxy can still be initialized.");
46 public function testIssueProxyClear()
48 $user = new DDC1238User;
49 $user->setName("test");
51 $this->_em->persist($user);
55 // force proxy load, getId() doesn't work anymore
57 $userId = $user->getId();
60 $user = $this->_em->getReference(__NAMESPACE__ . '\\DDC1238User', $userId);
63 $user2 = $this->_em->getReference(__NAMESPACE__ . '\\DDC1238User', $userId);
65 // force proxy load, getId() doesn't work anymore
67 $this->assertNull($user->getId(), "Now this is null, we already have a user instance of that type");
76 /** @Id @GeneratedValue @Column(type="integer") */
85 public function getId()
90 public function getName()
95 public function setName($name)