Completed
Pull Request — master (#5580)
by Marco
10:58
created

User::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %
Metric Value
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Entities;
4
5
/** @Entity @Table(name="users") */
6
class User
7
{
8
    /**
9
     * @Id @Column(type="integer")
10
     * @GeneratedValue(strategy="AUTO")
11
     */
12
    private $id;
13
    /** @Column(type="string", length=50) */
14
    private $name;
15
    /**
16
     * @OneToOne(targetEntity="Address", inversedBy="user")
17
     * @JoinColumn(name="address_id", referencedColumnName="id")
18
     */
19
    private $address;
20
21
    public function getId()
22
    {
23
        return $this->id;
24
    }
25
26
    public function getName()
27
    {
28
        return $this->name;
29
    }
30
31
    public function setName($name)
32
    {
33
        $this->name = $name;
34
    }
35
36
    public function getAddress()
37
    {
38
        return $this->address;
39
    }
40
41
    public function setAddress(Address $address)
42
    {
43
        if ($this->address !== $address) {
44
            $this->address = $address;
45
            $address->setUser($this);
46
        }
47
    }
48
}