3 namespace Doctrine\Tests\ORM\Functional\Ticket;
5 use Doctrine\Common\Collections\ArrayCollection;
6 use Doctrine\Tests\Models\CMS\CmsEmployee;
8 require_once __DIR__ . '/../../../TestInit.php';
13 class DDC1250Test extends \Doctrine\Tests\OrmFunctionalTestCase
15 public function setUp()
19 $this->_schemaTool->createSchema(array(
20 $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1250ClientHistory'),
22 } catch(\PDOException $e) {
27 public function testIssue()
29 $c1 = new DDC1250ClientHistory;
30 $c2 = new DDC1250ClientHistory;
31 $c1->declinedClientsHistory = $c2;
32 $c1->declinedBy = $c2;
33 $c2->declinedBy = $c1;
34 $c2->declinedClientsHistory= $c1;
36 $this->_em->persist($c1);
37 $this->_em->persist($c2);
41 $history = $this->_em->createQuery('SELECT h FROM ' . __NAMESPACE__ . '\\DDC1250ClientHistory h WHERE h.id = ?1')
42 ->setParameter(1, $c2->id)->getSingleResult();
44 $this->assertInstanceOf(__NAMESPACE__ . '\\DDC1250ClientHistory', $history);
51 class DDC1250ClientHistory
53 /** @Id @GeneratedValue @Column(type="integer") */
56 /** @OneToOne(targetEntity="DDC1250ClientHistory", inversedBy="declinedBy")
57 * @JoinColumn(name="declined_clients_history_id", referencedColumnName="id")
59 public $declinedClientsHistory;
62 * @OneToOne(targetEntity="DDC1250ClientHistory", mappedBy="declinedClientsHistory")
70 Entities\ClientsHistory:
72 table: clients_history
83 declinedClientsHistory:
84 targetEntity: Entities\ClientsHistory
86 name: declined_clients_history_id
87 referencedColumnName: id
88 inversedBy: declinedBy
90 targetEntity: Entities\ClientsHistory
91 mappedBy: declinedClientsHistory
92 lifecycleCallbacks: { }
93 repositoryClass: Entities\ClientsHistoryRepository