1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Doctrine\Tests\Functional\Ticket; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\Tests\OrmFunctionalTestCase; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @group 7180 |
10
|
|
|
*/ |
11
|
|
|
class DDC7180Test extends OrmFunctionalTestCase |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* {@inheritDoc} |
15
|
|
|
*/ |
16
|
|
|
protected function setUp() : void |
17
|
|
|
{ |
18
|
|
|
parent::setUp(); |
19
|
|
|
|
20
|
|
|
$this->_schemaTool->createSchema([ |
21
|
|
|
$this->_em->getClassMetadata(DDC7180A::class), |
22
|
|
|
$this->_em->getClassMetadata(DDC7180B::class), |
23
|
|
|
$this->_em->getClassMetadata(DDC7180C::class), |
24
|
|
|
]); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* {@inheritDoc} |
29
|
|
|
*/ |
30
|
|
|
protected function tearDown() : void |
31
|
|
|
{ |
32
|
|
|
parent::tearDown(); |
33
|
|
|
|
34
|
|
|
$this->_schemaTool->dropSchema([ |
35
|
|
|
$this->_em->getClassMetadata(DDC7180A::class), |
36
|
|
|
$this->_em->getClassMetadata(DDC7180B::class), |
37
|
|
|
$this->_em->getClassMetadata(DDC7180C::class), |
38
|
|
|
]); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function testIssue() : void |
42
|
|
|
{ |
43
|
|
|
$a = new DDC7180A(); |
44
|
|
|
$b = new DDC7180B(); |
45
|
|
|
$c = new DDC7180C(); |
46
|
|
|
|
47
|
|
|
$a->b = $b; |
48
|
|
|
$b->a = $a; |
49
|
|
|
$c->a = $a; |
50
|
|
|
|
51
|
|
|
$this->_em->persist($a); |
52
|
|
|
$this->_em->persist($b); |
53
|
|
|
$this->_em->persist($c); |
54
|
|
|
|
55
|
|
|
$this->_em->flush(); |
56
|
|
|
|
57
|
|
|
self::assertInternalType('integer', $a->id); |
58
|
|
|
self::assertInternalType('integer', $b->id); |
59
|
|
|
self::assertInternalType('integer', $c->id); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @Entity |
65
|
|
|
*/ |
66
|
|
|
class DDC7180A |
67
|
|
|
{ |
68
|
|
|
/** |
69
|
|
|
* @GeneratedValue() |
70
|
|
|
* @Id @Column(type="integer") |
71
|
|
|
*/ |
72
|
|
|
public $id; |
73
|
|
|
/** |
74
|
|
|
* @OneToOne(targetEntity=DDC7180B::class, inversedBy="a") |
75
|
|
|
* @JoinColumn(nullable=false) |
76
|
|
|
*/ |
77
|
|
|
public $b; |
78
|
|
|
} |
79
|
|
|
/** |
80
|
|
|
* @Entity |
81
|
|
|
*/ |
82
|
|
|
class DDC7180B |
83
|
|
|
{ |
84
|
|
|
/** |
85
|
|
|
* @GeneratedValue() |
86
|
|
|
* @Id @Column(type="integer") |
87
|
|
|
*/ |
88
|
|
|
public $id; |
89
|
|
|
/** |
90
|
|
|
* @OneToOne(targetEntity=DDC7180A::class, mappedBy="b") |
91
|
|
|
* @JoinColumn(nullable=true) |
92
|
|
|
*/ |
93
|
|
|
public $a; |
94
|
|
|
} |
95
|
|
|
/** |
96
|
|
|
* @Entity |
97
|
|
|
*/ |
98
|
|
|
class DDC7180C |
99
|
|
|
{ |
100
|
|
|
/** |
101
|
|
|
* @GeneratedValue() |
102
|
|
|
* @Id @Column(type="integer") |
103
|
|
|
*/ |
104
|
|
|
public $id; |
105
|
|
|
/** |
106
|
|
|
* @ManyToOne(targetEntity=DDC7180A::class) |
107
|
|
|
* @JoinColumn(nullable=false) |
108
|
|
|
*/ |
109
|
|
|
public $a; |
110
|
|
|
} |
111
|
|
|
|