Passed
Push — master ( be2445...fa5f59 )
by Anthony
09:40 queued 09:40
created

AccessRight::getGuid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PiouPiou\RibsAdminBundle\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Gedmo\Mapping\Annotation as Gedmo;
8
9
10
/**
11
 * AccessRight
12
 *
13
 * @ORM\Table(name="access_right", uniqueConstraints={@ORM\UniqueConstraint(name="guid_UNIQUE_access_right", columns={"guid"})})
14
 * @ORM\Entity(repositoryClass="PiouPiou\RibsAdminBundle\Repository\AccessRightRepository")
15
 * @ORM\EntityListeners({"PiouPiou\RibsAdminBundle\EventListener\GuidAwareListener", "PiouPiou\RibsAdminBundle\EventListener\CreateUpdateAwareListener"})
16
 */
17
class AccessRight
18
{
19
    use GuidTrait;
20
    use CreatedUpdatedTrait;
21
22
	/**
23
	 * @var integer
24
	 *
25
	 * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
26
	 * @ORM\Id
27
	 * @ORM\GeneratedValue(strategy="IDENTITY")
28
	 */
29
	private $id;
30
	
31
	/**
32
	 * @var string
33
	 *
34
	 * @ORM\Column(name="name", type="string", length=255, nullable=false)
35
	 */
36
	private $name;
37
	
38
	/**
39
	 * @var string
40
	 *
41
	 * @ORM\Column(name="access_rights", type="text", nullable=true)
42
	 */
43
	private $accessRights;
44
	
45
	/**
46
	 * @var ArrayCollection
47
	 *
48
	 * @ORM\OneToMany(targetEntity="PiouPiou\RibsAdminBundle\Entity\User", mappedBy="accessRightList")
49
	 */
50
	private $users;
51
	
52
	/**
53
	 * AccessRight constructor.
54
	 */
55
	public function __construct()
56
	{
57
		$this->users = new ArrayCollection();
58
	}
59
	
60
	/**
61
	 * @return int
62
	 */
63
	public function getId()
64
	{
65
		return $this->id;
66
	}
67
	
68
	/**
69
	 * @param int $id
70
	 */
71
	public function setId(int $id)
72
	{
73
		$this->id = $id;
74
	}
75
	
76
	/**
77
	 * @return string
78
	 */
79
	public function getName()
80
	{
81
		return $this->name;
82
	}
83
	
84
	/**
85
	 * @param string $name
86
	 */
87
	public function setName(string $name)
88
	{
89
		$this->name = $name;
90
	}
91
	
92
	/**
93
	 * @return string
94
	 */
95
	public function getAccessRights()
96
	{
97
		return $this->accessRights;
98
	}
99
	
100
	/**
101
	 * @param string $accessRights
102
	 */
103
	public function setAccessRights(string $accessRights)
104
	{
105
		$this->accessRights = $accessRights;
106
	}
107
	
108
	/**
109
	 * @return ArrayCollection
110
	 */
111
	public function getUsers()
112
	{
113
		return $this->users;
114
	}
115
	
116
	/**
117
	 * @param User $user
118
	 * @return $this
119
	 */
120
	public function addUser(User $user)
121
	{
122
		$this->users[] = $user;
123
		
124
		return $this;
125
	}
126
	
127
	/**
128
	 * @param User $user
129
	 */
130
	public function removeUser(User $user)
131
	{
132
		$this->users->removeElement($user);
133
	}
134
}
135