DDC1454Test.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Doctrine\Tests\ORM\Functional\Ticket;
  3. use Doctrine\ORM\UnitOfWork;
  4. require_once __DIR__ . '/../../../TestInit.php';
  5. /**
  6. * @group DDC-1454
  7. */
  8. class DDC1454Test extends \Doctrine\Tests\OrmFunctionalTestCase
  9. {
  10. protected function setUp()
  11. {
  12. parent::setUp();
  13. try {
  14. $this->_schemaTool->createSchema(array(
  15. $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1454File'),
  16. $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1454Picture'),
  17. ));
  18. } catch (\Exception $ignored) {
  19. }
  20. }
  21. public function testFailingCase()
  22. {
  23. $pic = new DDC1454Picture();
  24. $this->_em->getUnitOfWork()->getEntityState($pic);
  25. }
  26. }
  27. /**
  28. * @Entity
  29. */
  30. class DDC1454Picture extends DDC1454File
  31. {
  32. }
  33. /**
  34. * @Entity
  35. * @InheritanceType("JOINED")
  36. * @DiscriminatorColumn(name="discr", type="string")
  37. * @DiscriminatorMap({"picture" = "DDC1454Picture"})
  38. */
  39. class DDC1454File
  40. {
  41. /**
  42. * @Column(name="file_id", type="integer")
  43. * @Id
  44. */
  45. public $fileId;
  46. public function __construct() {
  47. $this->fileId = rand();
  48. }
  49. /**
  50. * Get fileId
  51. */
  52. public function getFileId() {
  53. return $this->fileId;
  54. }
  55. }