1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Doctrine\Tests\Functional\Ticket; |
4
|
|
|
|
5
|
|
|
use Doctrine\Tests\OrmFunctionalTestCase; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @group 7180 |
9
|
|
|
*/ |
10
|
|
|
final class DDC7180Test extends OrmFunctionalTestCase |
11
|
|
|
{ |
12
|
|
|
protected function setUp(): void |
13
|
|
|
{ |
14
|
|
|
parent::setUp(); |
15
|
|
|
|
16
|
|
|
$this->setUpEntitySchema([DDC7180A::class, DDC7180B::class, DDC7180C::class, DDC7180D::class, DDC7180E::class, DDC7180F::class, DDC7180G::class]); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function testIssue(): void |
20
|
|
|
{ |
21
|
|
|
$a = new DDC7180A(); |
22
|
|
|
$b = new DDC7180B(); |
23
|
|
|
$c = new DDC7180C(); |
24
|
|
|
|
25
|
|
|
$a->b = $b; |
26
|
|
|
$b->a = $a; |
27
|
|
|
$c->a = $a; |
28
|
|
|
|
29
|
|
|
$this->_em->persist($a); |
30
|
|
|
$this->_em->persist($b); |
31
|
|
|
$this->_em->persist($c); |
32
|
|
|
|
33
|
|
|
$this->_em->flush(); |
34
|
|
|
|
35
|
|
|
self::assertInternalType('integer', $a->id); |
36
|
|
|
self::assertInternalType('integer', $b->id); |
37
|
|
|
self::assertInternalType('integer', $c->id); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function testIssue3NodeCycle(): void |
41
|
|
|
{ |
42
|
|
|
$d = new DDC7180D(); |
43
|
|
|
$e = new DDC7180E(); |
44
|
|
|
$f = new DDC7180F(); |
45
|
|
|
$g = new DDC7180G(); |
46
|
|
|
|
47
|
|
|
$d->e = $e; |
48
|
|
|
$e->f = $f; |
49
|
|
|
$f->d = $d; |
50
|
|
|
$g->d = $d; |
51
|
|
|
|
52
|
|
|
$this->_em->persist($d); |
53
|
|
|
$this->_em->persist($e); |
54
|
|
|
$this->_em->persist($f); |
55
|
|
|
$this->_em->persist($g); |
56
|
|
|
|
57
|
|
|
$this->_em->flush(); |
58
|
|
|
|
59
|
|
|
self::assertInternalType('integer', $d->id); |
60
|
|
|
self::assertInternalType('integer', $e->id); |
61
|
|
|
self::assertInternalType('integer', $f->id); |
62
|
|
|
self::assertInternalType('integer', $g->id); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @Entity |
68
|
|
|
*/ |
69
|
|
|
class DDC7180A |
70
|
|
|
{ |
71
|
|
|
/** |
72
|
|
|
* @GeneratedValue() |
73
|
|
|
* @Id @Column(type="integer") |
74
|
|
|
*/ |
75
|
|
|
public $id; |
76
|
|
|
/** |
77
|
|
|
* @OneToOne(targetEntity=DDC7180B::class, inversedBy="a") |
78
|
|
|
* @JoinColumn(nullable=false) |
79
|
|
|
*/ |
80
|
|
|
public $b; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @Entity |
85
|
|
|
*/ |
86
|
|
|
class DDC7180B |
87
|
|
|
{ |
88
|
|
|
/** |
89
|
|
|
* @GeneratedValue() |
90
|
|
|
* @Id @Column(type="integer") |
91
|
|
|
*/ |
92
|
|
|
public $id; |
93
|
|
|
/** |
94
|
|
|
* @OneToOne(targetEntity=DDC7180A::class, mappedBy="b") |
95
|
|
|
* @JoinColumn(nullable=true) |
96
|
|
|
*/ |
97
|
|
|
public $a; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @Entity |
102
|
|
|
*/ |
103
|
|
|
class DDC7180C |
104
|
|
|
{ |
105
|
|
|
/** |
106
|
|
|
* @GeneratedValue() |
107
|
|
|
* @Id @Column(type="integer") |
108
|
|
|
*/ |
109
|
|
|
public $id; |
110
|
|
|
/** |
111
|
|
|
* @ManyToOne(targetEntity=DDC7180A::class) |
112
|
|
|
* @JoinColumn(nullable=false) |
113
|
|
|
*/ |
114
|
|
|
public $a; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @Entity |
119
|
|
|
*/ |
120
|
|
|
class DDC7180D |
121
|
|
|
{ |
122
|
|
|
/** |
123
|
|
|
* @GeneratedValue() |
124
|
|
|
* @Id @Column(type="integer") |
125
|
|
|
*/ |
126
|
|
|
public $id; |
127
|
|
|
/** |
128
|
|
|
* @OneToOne(targetEntity=DDC7180E::class) |
129
|
|
|
* @JoinColumn(nullable=false) |
130
|
|
|
*/ |
131
|
|
|
public $e; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @Entity |
136
|
|
|
*/ |
137
|
|
|
class DDC7180E |
138
|
|
|
{ |
139
|
|
|
/** |
140
|
|
|
* @GeneratedValue() |
141
|
|
|
* @Id @Column(type="integer") |
142
|
|
|
*/ |
143
|
|
|
public $id; |
144
|
|
|
/** |
145
|
|
|
* @OneToOne(targetEntity=DDC7180F::class) |
146
|
|
|
* @JoinColumn(nullable=false) |
147
|
|
|
*/ |
148
|
|
|
public $f; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @Entity |
153
|
|
|
*/ |
154
|
|
|
class DDC7180F |
155
|
|
|
{ |
156
|
|
|
/** |
157
|
|
|
* @GeneratedValue() |
158
|
|
|
* @Id @Column(type="integer") |
159
|
|
|
*/ |
160
|
|
|
public $id; |
161
|
|
|
/** |
162
|
|
|
* @ManyToOne(targetEntity=DDC7180D::class) |
163
|
|
|
* @JoinColumn(nullable=true) |
164
|
|
|
*/ |
165
|
|
|
public $d; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @Entity |
170
|
|
|
*/ |
171
|
|
|
class DDC7180G |
172
|
|
|
{ |
173
|
|
|
/** |
174
|
|
|
* @GeneratedValue() |
175
|
|
|
* @Id @Column(type="integer") |
176
|
|
|
*/ |
177
|
|
|
public $id; |
178
|
|
|
/** |
179
|
|
|
* @ManyToOne(targetEntity=DDC7180D::class) |
180
|
|
|
* @JoinColumn(nullable=false) |
181
|
|
|
*/ |
182
|
|
|
public $d; |
183
|
|
|
} |
184
|
|
|
|