Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #877 from aaronmu/DDC-1787
Hotfix for DDC-1787
- Loading branch information
Showing
2 changed files
with
67 additions
and
4 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
63 changes: 63 additions & 0 deletions
63
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1787Test.php
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,63 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\ORM\Functional\Ticket; | ||
|
||
require_once __DIR__ . '/../../../TestInit.php'; | ||
|
||
/** | ||
* @group DDC-1787 | ||
*/ | ||
class DDC1787Test extends \Doctrine\Tests\OrmFunctionalTestCase | ||
{ | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->_schemaTool->createSchema(array( | ||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1787Foo'), | ||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1787Bar'), | ||
)); | ||
} | ||
|
||
public function testIssue() | ||
{ | ||
$bar = new DDC1787Bar; | ||
$bar2 = new DDC1787Bar; | ||
|
||
$this->_em->persist($bar); | ||
$this->_em->persist($bar2); | ||
$this->_em->flush(); | ||
|
||
$this->assertSame(1, $bar->getVersion()); | ||
} | ||
} | ||
|
||
/** | ||
* @Entity | ||
* @InheritanceType("JOINED") | ||
* @DiscriminatorColumn(name="discr", type="string") | ||
* @DiscriminatorMap({"bar" = "DDC1787Bar"}) | ||
*/ | ||
class DDC1787Foo | ||
{ | ||
/** | ||
* @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @Version @Column(type="integer") | ||
*/ | ||
private $version; | ||
|
||
public function getVersion() | ||
{ | ||
return $this->version; | ||
} | ||
} | ||
|
||
/** | ||
* @Entity | ||
*/ | ||
class DDC1787Bar extends DDC1787Foo | ||
{ | ||
} |