Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test case showing the regression
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\ORM\Functional\Ticket; | ||
|
||
use Doctrine\Tests\OrmFunctionalTestCase; | ||
|
||
/** | ||
* @group GHxxxx | ||
*/ | ||
final class GHxxxxTest extends OrmFunctionalTestCase | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function setUp() : void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->setUpEntitySchema([ | ||
GHxxxxBaseClass::class, | ||
GHxxxxSubClass::class, | ||
]); | ||
} | ||
|
||
public function testNumericDescriminatorColumn() : void | ||
{ | ||
$entity = new GHxxxxSubClass(); | ||
$entity->value = 'test'; | ||
$this->_em->persist($entity); | ||
$this->_em->flush(); | ||
$this->_em->clear(); | ||
|
||
$repository = $this->_em->getRepository(GHxxxxSubClass::class); | ||
$hydrated = $repository->find($entity->id); | ||
|
||
self::assertSame('test', $hydrated->value); | ||
} | ||
} | ||
|
||
/** | ||
* @Entity() | ||
* @Table(name="ghxxxx") | ||
* @InheritanceType("JOINED") | ||
* @DiscriminatorColumn(name="discr", type="integer") | ||
* @DiscriminatorMap({ | ||
* 1 = GHxxxxBaseClass::class, | ||
* 2 = GHxxxxSubClass::class | ||
* }) | ||
*/ | ||
class GHxxxxBaseClass | ||
{ | ||
/** | ||
* @Id @GeneratedValue | ||
* @Column(type="integer") | ||
*/ | ||
public $id; | ||
} | ||
|
||
/** | ||
* @Entity() | ||
*/ | ||
class GHxxxxSubClass extends GHxxxxBaseClass | ||
{ | ||
/** | ||
* @Column(name="test", type="string") | ||
* @var string | ||
*/ | ||
public $value; | ||
} |