Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctrinebot/9dce97f7e9423d16194e to your computer and use it in GitHub Desktop.
Save doctrinebot/9dce97f7e9423d16194e to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-1454 - https://github.com/doctrine/doctrine2/issues/2082
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\ORM\UnitOfWork;
require_once __DIR__ . '/../../../TestInit.php';
class DDC1454Test extends \Doctrine\Tests\OrmFunctionalTestCase
{
protected function setUp()
{
parent::setUp();
try {
$this->_schemaTool->createSchema(array(
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1454File'),
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1454Picture'),
));
} catch(\Exception $ignored) {}
}
public function testFailingCase()
{
$pic = new DDC1454Picture();
$this->_em->getUnitOfWork()->getEntityState($pic);
}
}
/**
* @Entity
*/
class DDC1454Picture extends DDC1454File
{
}
/**
* @Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorMap({"picture" = "DDC1454Picture"})
*/
class DDC1454File
{
/**
* @Column(name="file_id", type="integer")
* @Id
*/
public $fileId;
public function __construct()
{
$this->fileId = rand();
}
/**
* Get fileId
*/
public function getFileId()
{
return $this->fileId;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment