Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:38
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/4df3c749f144ffbea002 to your computer and use it in GitHub Desktop.
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
<?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