Passed
Push — master ( 26f0d1...865369 )
by Anthony
03:01
created

AccessRight   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 138
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 20
c 1
b 0
f 1
dl 0
loc 138
rs 10
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getAccessRights() 0 3 1
A removeUser() 0 3 1
A getGuid() 0 3 1
A addUser() 0 5 1
A getId() 0 3 1
A setGuid() 0 3 1
A getUsers() 0 3 1
A __construct() 0 3 1
A getName() 0 3 1
A setAccessRights() 0 3 1
A setId() 0 3 1
A setName() 0 3 1
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", 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 CreatedUpdatedTrait;
20
21
	/**
22
	 * @var integer
23
	 *
24
	 * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
25
	 * @ORM\Id
26
	 * @ORM\GeneratedValue(strategy="IDENTITY")
27
	 */
28
	private $id;
29
	
30
	/**
31
	 * @var string
32
	 *
33
	 * @ORM\Column(name="guid", type="string", length=255, nullable=false)
34
	 */
35
	private $guid;
36
	
37
	/**
38
	 * @var string
39
	 *
40
	 * @ORM\Column(name="name", type="string", length=255, nullable=false)
41
	 */
42
	private $name;
43
	
44
	/**
45
	 * @var string
46
	 *
47
	 * @ORM\Column(name="access_rights", type="text", nullable=true)
48
	 */
49
	private $accessRights;
50
	
51
	/**
52
	 * @var ArrayCollection
53
	 *
54
	 * @ORM\OneToMany(targetEntity="PiouPiou\RibsAdminBundle\Entity\User", mappedBy="accessRightList")
55
	 */
56
	private $users;
57
	
58
	/**
59
	 * AccessRight constructor.
60
	 */
61
	public function __construct()
62
	{
63
		$this->users = new ArrayCollection();
64
	}
65
	
66
	/**
67
	 * @return int
68
	 */
69
	public function getId()
70
	{
71
		return $this->id;
72
	}
73
	
74
	/**
75
	 * @param int $id
76
	 */
77
	public function setId(int $id)
78
	{
79
		$this->id = $id;
80
	}
81
	
82
	/**
83
	 * @return string
84
	 */
85
	public function getGuid()
86
	{
87
		return $this->guid;
88
	}
89
	
90
	/**
91
	 * @param string $guid
92
	 */
93
	public function setGuid(string $guid)
94
	{
95
		$this->guid = $guid;
96
	}
97
	
98
	/**
99
	 * @return string
100
	 */
101
	public function getName()
102
	{
103
		return $this->name;
104
	}
105
	
106
	/**
107
	 * @param string $name
108
	 */
109
	public function setName(string $name)
110
	{
111
		$this->name = $name;
112
	}
113
	
114
	/**
115
	 * @return string
116
	 */
117
	public function getAccessRights()
118
	{
119
		return $this->accessRights;
120
	}
121
	
122
	/**
123
	 * @param string $accessRights
124
	 */
125
	public function setAccessRights(string $accessRights)
126
	{
127
		$this->accessRights = $accessRights;
128
	}
129
	
130
	/**
131
	 * @return ArrayCollection
132
	 */
133
	public function getUsers()
134
	{
135
		return $this->users;
136
	}
137
	
138
	/**
139
	 * @param User $user
140
	 * @return $this
141
	 */
142
	public function addUser(User $user)
143
	{
144
		$this->users[] = $user;
145
		
146
		return $this;
147
	}
148
	
149
	/**
150
	 * @param User $user
151
	 */
152
	public function removeUser(User $user)
153
	{
154
		$this->users->removeElement($user);
155
	}
156
}
157