Completed
Push — Recipes ( dbf056...2148c4 )
by Laurent
02:44
created

Group   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 64
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 4 1
A getUsers() 0 4 1
A addUser() 0 6 1
A removeUser() 0 4 1
1
<?php
2
/**
3
 * Entité Group.
4
 *
5
 * PHP Version 5
6
 *
7
 * @author    Quétier Laurent <[email protected]>
8
 * @copyright 2014 Dev-Int GLSR
9
 * @license   http://opensource.org/licenses/gpl-license.php GNU Public License
10
 *
11
 * @version GIT: <git_id>
12
 *
13
 * @link https://github.com/Dev-Int/glsr
14
 */
15
namespace AppBundle\Entity\Staff;
16
17
use FOS\UserBundle\Model\Group as BaseGroup;
18
use AppBundle\Entity\Staff\User;
19
use Doctrine\ORM\Mapping as ORM;
20
21
/**
22
 * Entité Group.
23
 *
24
 * @category Entity
25
 *
26
 * @ORM\Entity
27
 * @ORM\Entity(repositoryClass="AppBundle\Repository\Staff\GroupRepository")
28
 * @ORM\Table(name="fos_group")
29
 */
30
class Group extends BaseGroup
31
{
32
    /**
33
     * @ORM\Id
34
     * @ORM\Column(type="integer")
35
     * @ORM\GeneratedValue(strategy="AUTO")
36
     */
37
    protected $id;
38
39
    /**
40
     * @var string
41
     */
42
    protected $name;
43
44
    /**
45
     * @var array
46
     */
47
    protected $roles;
48
49
    /**
50
     * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Staff\User", mappedBy="groups")
51
     *
52
     */
53
    protected $users;
54
55
    public function __toString()
56
    {
57
        return $this->getName();
58
    }
59
60
61
    /**
62
     * Get Users
63
     *
64
     * @return AppBundle\Entity\Staff\User
65
     */
66
    public function getUsers()
67
    {
68
        return $this->users;
69
    }
70
71
    /**
72
     * Add users
73
     *
74
     * @param \AppBundle\Entity\Staff\User $users
75
     * @return Group
76
     */
77
    public function addUser(User $users)
78
    {
79
        $this->users[] = $users;
80
81
        return $this;
82
    }
83
84
    /**
85
     * Remove users
86
     *
87
     * @param \AppBundle\Entity\Staff\User $users
88
     */
89
    public function removeUser(User $users)
90
    {
91
        $this->users->removeElement($users);
0 ignored issues
show
Bug introduced by
The method removeElement cannot be called on $this->users (of type array<integer,object<App...dle\Entity\Staff\User>>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
92
    }
93
}
94