UserReferenceTrait::getUser()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Dominikzogg\EnergyCalculator\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Dominikzogg\EnergyCalculator\Voter\RelatedObjectInterface;
7
8
trait UserReferenceTrait
9
{
10
    /**
11
     * @var User
12
     * @ORM\ManyToOne(targetEntity="User")
13
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
14
     */
15
    protected $user;
16
17
    /**
18
     * @return User
19
     */
20
    public function getUser()
21
    {
22
        return $this->user;
23
    }
24
25
    /**
26
     * @param  User  $user
27
     * @return $this
28
     */
29
    public function setUser(User $user)
30
    {
31
        $this->user = $user;
32
33
        return $this;
34
    }
35
36
    /**
37
     * @return RelatedObjectInterface[]
38
     */
39
    public function getSecurityRelatedObjects()
40
    {
41
        return array($this->getUser());
42
    }
43
}
44