2010-02-28 17:45:09 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\ORM\Functional\Ticket;
|
|
|
|
use Doctrine\ORM\UnitOfWork;
|
|
|
|
|
|
|
|
require_once __DIR__ . '/../../../TestInit.php';
|
|
|
|
|
|
|
|
class DDC381Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|
|
|
{
|
|
|
|
protected function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
try {
|
|
|
|
$this->_schemaTool->createSchema(array(
|
|
|
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC381Entity'),
|
|
|
|
));
|
|
|
|
} catch(\Exception $e) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testCallUnserializedProxyMethods()
|
|
|
|
{
|
|
|
|
$entity = new DDC381Entity();
|
|
|
|
|
|
|
|
$this->_em->persist($entity);
|
|
|
|
$this->_em->flush();
|
|
|
|
$this->_em->clear();
|
|
|
|
$persistedId = $entity->getId();
|
|
|
|
|
|
|
|
$entity = $this->_em->getReference('Doctrine\Tests\ORM\Functional\Ticket\DDC381Entity', $persistedId);
|
|
|
|
|
2011-05-20 22:50:03 +04:00
|
|
|
// explicitly load proxy (getId() does not trigger reload of proxy)
|
|
|
|
$id = $entity->getOtherMethod();
|
2010-02-28 17:45:09 +03:00
|
|
|
|
|
|
|
$data = serialize($entity);
|
|
|
|
$entity = unserialize($data);
|
|
|
|
|
|
|
|
$this->assertEquals($persistedId, $entity->getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Entity
|
|
|
|
*/
|
|
|
|
class DDC381Entity
|
|
|
|
{
|
|
|
|
/**
|
2010-04-10 02:00:36 +04:00
|
|
|
* @Id @Column(type="integer") @GeneratedValue
|
2010-02-28 17:45:09 +03:00
|
|
|
*/
|
|
|
|
protected $id;
|
|
|
|
|
|
|
|
public function getId()
|
|
|
|
{
|
|
|
|
return $this->id;
|
|
|
|
}
|
2011-05-20 22:50:03 +04:00
|
|
|
|
|
|
|
public function getOtherMethod()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2010-02-28 17:45:09 +03:00
|
|
|
}
|