Skip to content

Commit 5f0edff

Browse files
committed
review
1 parent 7143964 commit 5f0edff

File tree

5 files changed

+84
-112
lines changed

5 files changed

+84
-112
lines changed

tests/Doctrine/Tests/Models/Issue7877/Issue7877ApplicationGenerated.php

-33
This file was deleted.

tests/Doctrine/Tests/Models/Issue7877/Issue7877DatabaseGenerated.php

-28
This file was deleted.

tests/Doctrine/Tests/Models/Issue7877/Issue7877Interface.php

-14
This file was deleted.

tests/Doctrine/Tests/Models/Issue7877/Issue7877Trait.php

-32
This file was deleted.

tests/Doctrine/Tests/ORM/Functional/SelfReferencingTest.php

+84-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
namespace Doctrine\Tests\ORM\Functional;
66

7-
use Doctrine\Tests\Models\Issue7877\Issue7877ApplicationGenerated;
8-
use Doctrine\Tests\Models\Issue7877\Issue7877DatabaseGenerated;
9-
use Doctrine\Tests\Models\Issue7877\Issue7877Interface;
7+
use Doctrine\ORM\Annotation as ORM;
108
use Doctrine\Tests\OrmFunctionalTestCase;
119

1210
class SelfReferencingTest extends OrmFunctionalTestCase
@@ -39,11 +37,9 @@ public function testDifferentEntity(string $class)
3937
{
4038
$count = count($this->sqlLoggerStack->queries);
4139

42-
/** @var Issue7877Interface $parent */
4340
$parent = new $class($parentId = 1);
4441
$this->em->persist($parent);
4542

46-
/** @var Issue7877Interface $child */
4743
$child = new $class($childId = 2);
4844
$child->setParent($parent);
4945
$this->em->persist($child);
@@ -92,3 +88,86 @@ public function testSameEntityDatabaseGenerated()
9288
$this->assertSame($entityId, $child->getParent()->getId());
9389
}
9490
}
91+
92+
/**
93+
* @ORM\Entity
94+
*/
95+
class Issue7877ApplicationGenerated
96+
{
97+
public function __construct(int $id)
98+
{
99+
$this->id = $id;
100+
}
101+
102+
/**
103+
* @ORM\Id
104+
* @ORM\Column(type="integer")
105+
* @ORM\GeneratedValue(strategy="NONE")
106+
*/
107+
private $id;
108+
109+
public function getId(): ?int
110+
{
111+
return $this->id;
112+
}
113+
114+
public function setId(int $id)
115+
{
116+
$this->id = $id;
117+
}
118+
119+
/**
120+
* @var self
121+
* @ORM\ManyToOne(targetEntity="Doctrine\Tests\ORM\Functional\Issue7877ApplicationGenerated")
122+
*/
123+
private $parent;
124+
125+
public function getParent(): ?self
126+
{
127+
return $this->parent;
128+
}
129+
130+
public function setParent(self $parent)
131+
{
132+
$this->parent = $parent;
133+
}
134+
}
135+
136+
/**
137+
* @ORM\Entity
138+
*/
139+
class Issue7877DatabaseGenerated
140+
{
141+
/**
142+
* @ORM\Id
143+
* @ORM\Column(type="integer")
144+
* @ORM\GeneratedValue(strategy="AUTO")
145+
*/
146+
private $id;
147+
148+
public function getId(): ?int
149+
{
150+
return $this->id;
151+
}
152+
153+
public function setId(int $id)
154+
{
155+
$this->id = $id;
156+
}
157+
158+
/**
159+
* @var self
160+
* @ORM\ManyToOne(targetEntity="Doctrine\Tests\ORM\Functional\Issue7877DatabaseGenerated")
161+
*/
162+
private $parent;
163+
164+
public function getParent(): ?self
165+
{
166+
return $this->parent;
167+
}
168+
169+
public function setParent(self $parent)
170+
{
171+
$this->parent = $parent;
172+
}
173+
}

0 commit comments

Comments
 (0)