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/663fcfa957f0b78e0750 to your computer and use it in GitHub Desktop.
Save doctrinebot/663fcfa957f0b78e0750 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-1607 - https://github.com/doctrine/doctrine2/issues/2246
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
/**
* @group DDC-1607
*/
class DDC1607Test extends \Doctrine\Tests\OrmFunctionalTestCase
{
public function setUp()
{
parent::setUp();
$this->_schemaTool->createSchema(array(
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1607A'),
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1607B'),
));
}
public function testIssue()
{
$a = new DDC1607A();
$this->_em->persist($a);
$this->_em->flush();
$this->_em->clear();
$persistedA = $this->_em->find(__NAMESPACE__ . '\\DDC1607A', $a->id);
$this->assertNotNull($persistedA);
}
}
/**
* @Entity
*/
class DDC1607A
{
/**
* @Id @GeneratedValue
* @Column(type="integer")
*/
public $id;
/**
* @OneToOne(targetEntity="DDC1607B", fetch="EAGER")
* @JoinColumn(nullable=true)
*/
public $b;
}
/**
* @Entity
*/
class DDC1607B
{
/**
* @Id @GeneratedValue
* @Column(type="integer")
*/
public $id;
/**
* @Column(type="string")
*/
public $name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment