-
-
Save doctrinebot/4df3c749f144ffbea002 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-1548 - https://github.com/doctrine/doctrine2/issues/2182
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
<?php | |
namespace Doctrine\Tests\ORM\Functional\Ticket; | |
/** | |
* @group DDC-1515 | |
*/ | |
class DDC1548Test extends \Doctrine\Tests\OrmFunctionalTestCase | |
{ | |
public function setUp() | |
{ | |
parent::setUp(); | |
$this->_schemaTool->createSchema(array( | |
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1548E1'), | |
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1548E2'), | |
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1548Rel'), | |
)); | |
} | |
public function testIssue() | |
{ | |
$rel = new DDC1548Rel(); | |
$this->_em->persist($rel); | |
$this->_em->flush(); | |
$e1 = new DDC1548E1(); | |
$e1->rel = $rel; | |
$this->_em->persist($e1); | |
$this->_em->flush(); | |
$this->_em->clear(); | |
$obt = $this->_em->find(__NAMESPACE__ . '\DDC1548Rel', $rel->id); | |
$this->assertNull($obt->e2); | |
} | |
} | |
/** | |
* @Entity | |
*/ | |
class DDC1548E1 | |
{ | |
/** | |
* @OneToOne(targetEntity="DDC1548Rel", inversedBy="e1") @Id | |
*/ | |
public $rel; | |
} | |
/** | |
* @Entity | |
*/ | |
class DDC1548E2 | |
{ | |
/** | |
* @OneToOne(targetEntity="DDC1548Rel", inversedBy="e2") @Id | |
*/ | |
public $rel; | |
} | |
/** | |
* @Entity | |
*/ | |
class DDC1548Rel | |
{ | |
/** | |
* @Id @Column(type="integer") @GeneratedValue | |
*/ | |
public $id; | |
/** | |
* @OneToOne(targetEntity="DDC1548E1", mappedBy="rel") | |
*/ | |
public $e1; | |
/** | |
* @OneToOne(targetEntity="DDC1548E2", mappedBy="rel") | |
*/ | |
public $e2; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment