1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace Doctrine\Tests\ORM\Functional\Ticket; |
5
|
|
|
|
6
|
|
|
use Doctrine\Tests\OrmFunctionalTestCase; |
7
|
|
|
|
8
|
|
|
final class GH7259Test extends OrmFunctionalTestCase |
9
|
|
|
{ |
10
|
|
|
protected function setUp() : void |
11
|
|
|
{ |
12
|
|
|
parent::setUp(); |
13
|
|
|
|
14
|
|
|
$this->setUpEntitySchema([GH7259Space::class, GH7259File::class, GH7259FileVersion::class, GH7259Feed::class]); |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @group 7259 |
19
|
|
|
*/ |
20
|
|
|
public function testPersistFileBeforeVersion() : void |
21
|
|
|
{ |
22
|
|
|
$space = new GH7259Space(); |
23
|
|
|
|
24
|
|
|
$this->_em->persist($space); |
25
|
|
|
$this->_em->flush(); |
26
|
|
|
|
27
|
|
|
$feed = new GH7259Feed(); |
28
|
|
|
$feed->space = $space; |
29
|
|
|
|
30
|
|
|
$file = new GH7259File(); |
31
|
|
|
$file->space = $space; |
32
|
|
|
$fileVersion = new GH7259FileVersion(); |
33
|
|
|
$fileVersion->file = $file; |
34
|
|
|
|
35
|
|
|
$this->_em->persist($file); |
36
|
|
|
$this->_em->persist($fileVersion); |
37
|
|
|
$this->_em->persist($feed); |
38
|
|
|
|
39
|
|
|
$this->_em->flush(); |
40
|
|
|
|
41
|
|
|
self::assertNotNull($fileVersion->id); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @group 7259 |
46
|
|
|
*/ |
47
|
|
|
public function testPersistFileAfterVersion() : void |
48
|
|
|
{ |
49
|
|
|
$space = new GH7259Space(); |
50
|
|
|
|
51
|
|
|
$this->_em->persist($space); |
52
|
|
|
$this->_em->flush(); |
53
|
|
|
$this->_em->clear(); |
54
|
|
|
|
55
|
|
|
$space = $this->_em->find(GH7259Space::class, $space->id); |
56
|
|
|
|
57
|
|
|
$feed = new GH7259Feed(); |
58
|
|
|
$feed->space = $space; |
59
|
|
|
|
60
|
|
|
$file = new GH7259File(); |
61
|
|
|
$file->space = $space; |
62
|
|
|
$fileVersion = new GH7259FileVersion(); |
63
|
|
|
$fileVersion->file = $file; |
64
|
|
|
|
65
|
|
|
$this->_em->persist($fileVersion); |
66
|
|
|
$this->_em->persist($file); |
67
|
|
|
$this->_em->persist($feed); |
68
|
|
|
|
69
|
|
|
$this->_em->flush(); |
70
|
|
|
|
71
|
|
|
self::assertNotNull($fileVersion->id); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @Entity() |
77
|
|
|
*/ |
78
|
|
|
class GH7259File |
79
|
|
|
{ |
80
|
|
|
/** |
81
|
|
|
* @Id |
82
|
|
|
* @GeneratedValue |
83
|
|
|
* @Column(type="integer") |
84
|
|
|
* |
85
|
|
|
* @var int |
86
|
|
|
*/ |
87
|
|
|
public $id; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @ManyToOne(targetEntity=GH7259Space::class) |
91
|
|
|
* @JoinColumn(nullable=false) |
92
|
|
|
* |
93
|
|
|
* @var GH7259Space|null |
94
|
|
|
*/ |
95
|
|
|
public $space; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @Entity() |
100
|
|
|
*/ |
101
|
|
|
class GH7259FileVersion |
102
|
|
|
{ |
103
|
|
|
/** |
104
|
|
|
* @Id |
105
|
|
|
* @GeneratedValue |
106
|
|
|
* @Column(type="integer") |
107
|
|
|
* |
108
|
|
|
* @var int |
109
|
|
|
*/ |
110
|
|
|
public $id; |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @ManyToOne(targetEntity=GH7259File::class) |
114
|
|
|
* @JoinColumn(nullable=false) |
115
|
|
|
* |
116
|
|
|
* @var GH7259File|null |
117
|
|
|
*/ |
118
|
|
|
public $file; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @Entity() |
123
|
|
|
*/ |
124
|
|
|
class GH7259Space |
125
|
|
|
{ |
126
|
|
|
/** |
127
|
|
|
* @Id |
128
|
|
|
* @GeneratedValue |
129
|
|
|
* @Column(type="integer") |
130
|
|
|
* |
131
|
|
|
* @var int |
132
|
|
|
*/ |
133
|
|
|
public $id; |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @ManyToOne(targetEntity=GH7259File::class) |
137
|
|
|
* @JoinColumn(nullable=true) |
138
|
|
|
* |
139
|
|
|
* @var GH7259File|null |
140
|
|
|
*/ |
141
|
|
|
public $ruleFile; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @Entity() |
146
|
|
|
*/ |
147
|
|
|
class GH7259Feed |
148
|
|
|
{ |
149
|
|
|
/** |
150
|
|
|
* @Id |
151
|
|
|
* @GeneratedValue |
152
|
|
|
* @Column(type="integer") |
153
|
|
|
* |
154
|
|
|
* @var int |
155
|
|
|
*/ |
156
|
|
|
public $id; |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @ManyToOne(targetEntity=GH7259Space::class) |
160
|
|
|
* @JoinColumn(nullable=false) |
161
|
|
|
* |
162
|
|
|
* @var GH7259Space|null |
163
|
|
|
*/ |
164
|
|
|
public $space; |
165
|
|
|
} |
166
|
|
|
|