2011-10-28 00:50:10 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\ORM\Functional\Ticket;
|
|
|
|
|
2017-05-31 16:36:31 +02:00
|
|
|
use Doctrine\ORM\UnitOfWork;
|
|
|
|
|
2011-10-28 00:50:10 +02:00
|
|
|
/**
|
|
|
|
* @group DDC-1454
|
|
|
|
*/
|
|
|
|
class DDC1454Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|
|
|
{
|
|
|
|
protected function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
try {
|
2016-12-07 23:33:41 +01:00
|
|
|
$this->_schemaTool->createSchema(
|
|
|
|
[
|
2017-05-31 07:59:04 +02:00
|
|
|
$this->_em->getClassMetadata(DDC1454File::class),
|
|
|
|
$this->_em->getClassMetadata(DDC1454Picture::class),
|
2016-12-07 23:33:41 +01:00
|
|
|
]
|
|
|
|
);
|
2011-10-28 00:50:10 +02:00
|
|
|
} catch (\Exception $ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testFailingCase()
|
|
|
|
{
|
|
|
|
$pic = new DDC1454Picture();
|
|
|
|
|
2017-05-31 16:36:31 +02:00
|
|
|
self::assertSame(UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($pic));
|
|
|
|
}
|
2011-10-28 00:50:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Entity
|
|
|
|
*/
|
|
|
|
class DDC1454Picture extends DDC1454File
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Entity
|
|
|
|
* @InheritanceType("JOINED")
|
|
|
|
* @DiscriminatorColumn(name="discr", type="string")
|
2015-01-15 03:48:53 +01:00
|
|
|
* @DiscriminatorMap({"file" = "DDC1454File", "picture" = "DDC1454Picture"})
|
2011-10-28 00:50:10 +02:00
|
|
|
*/
|
|
|
|
class DDC1454File
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @Column(name="file_id", type="integer")
|
|
|
|
* @Id
|
|
|
|
*/
|
|
|
|
public $fileId;
|
|
|
|
|
2017-05-31 07:59:04 +02:00
|
|
|
public function __construct()
|
|
|
|
{
|
2017-09-06 01:22:41 +02:00
|
|
|
$this->fileId = random_int(0, getrandmax());
|
2011-10-28 00:50:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get fileId
|
|
|
|
*/
|
2017-05-31 07:59:04 +02:00
|
|
|
public function getFileId()
|
|
|
|
{
|
2011-10-28 00:50:10 +02:00
|
|
|
return $this->fileId;
|
|
|
|
}
|
|
|
|
|
2014-04-07 14:43:25 +02:00
|
|
|
}
|