1
0
mirror of synced 2025-01-19 06:51:40 +03:00

#1172 - when merging an initialized proxy, the managed proxy must be initialized before merging

This commit is contained in:
Marco Pivetta 2015-01-16 21:23:47 +01:00
parent a18f258b4d
commit 3df119f4fe

View File

@ -62,6 +62,27 @@ class MergeUninitializedProxyTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->assertFalse($managed->__isInitialized());
}
public function testMergeInitializedProxy()
{
$file = new MUPFile();
$this->_em->persist($file);
$this->_em->flush();
$this->_em->clear();
$initialized = $this->_em->getReference(MUPFile::CLASSNAME, $file->fileId);
$initialized->__load();
$this->_em->clear();
$managed = $this->_em->getReference(MUPFile::CLASSNAME, $file->fileId);
$this->assertSame($managed, $this->_em->merge($initialized));
$this->assertTrue($managed->__isInitialized());
}
public function testMergeUnserializedIntoEntity() {
$file = new MUPFile;
@ -212,18 +233,14 @@ class MUPPicture
}
/**
* @Entity
*/
/** @Entity */
class MUPFile
{
const CLASSNAME = __CLASS__;
/**
* @Column(name="file_id", type="integer")
* @Id
* @GeneratedValue(strategy="AUTO")
*/
/** @Column(name="file_id", type="integer") @Id @GeneratedValue(strategy="AUTO") */
public $fileId;
/** @Column(type="string", nullable=true) */
private $contents;
}