1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Doctrine\Tests\Models\DDC2372; |
||
6 | |||
7 | use Doctrine\ORM\Annotation as ORM; |
||
8 | |||
9 | /** @ORM\Entity @ORM\Table(name="addresses") */ |
||
10 | class DDC2372Address |
||
11 | { |
||
12 | /** |
||
13 | * @ORM\Id @ORM\Column(type="integer") |
||
14 | * @ORM\GeneratedValue(strategy="AUTO") |
||
15 | */ |
||
16 | private $id; |
||
17 | |||
18 | /** @ORM\Column(type="string", length=255) */ |
||
19 | private $street; |
||
20 | |||
21 | /** @ORM\OneToOne(targetEntity=User::class, mappedBy="address") */ |
||
22 | private $user; |
||
23 | |||
24 | public function getId() |
||
25 | { |
||
26 | return $this->id; |
||
27 | } |
||
28 | |||
29 | public function getStreet() |
||
30 | { |
||
31 | return $this->street; |
||
32 | } |
||
33 | |||
34 | public function setStreet($street) |
||
35 | { |
||
36 | $this->street = $street; |
||
37 | } |
||
38 | |||
39 | public function getUser() |
||
40 | { |
||
41 | return $this->user; |
||
42 | } |
||
43 | |||
44 | public function setUser(User $user) |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
45 | { |
||
46 | if ($this->user !== $user) { |
||
47 | $this->user = $user; |
||
48 | $user->setAddress($this); |
||
49 | } |
||
50 | } |
||
51 | } |
||
52 |