Category::getClients()   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
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace ClientBundle\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
8
/**
9
 * Class Category
10
 * @ORM\Entity(repositoryClass="ClientBundle\Repository\CategoryRepository")
11
 * @ORM\Table(name="category")
12
 */
13
class Category
14
{
15
    /**
16
     * @ORM\Column(type="integer")
17
     * @ORM\Id
18
     * @ORM\GeneratedValue(strategy="AUTO")
19
     */
20
    private $id;
21
22
    /**
23
     * @ORM\Column(type="string", length=50, nullable=false)
24
     */
25
    private $name;
26
27
    /**
28
     * @ORM\ManyToMany(targetEntity="Client", mappedBy="categories")
29
     */
30
    private $clients;
31
32
    /**
33
     * Constructor
34
     */
35
    public function __construct()
36
    {
37
        $this->clients = new ArrayCollection();
38
    }
39
40
    /**
41
     * Get id
42
     *
43
     * @return integer
44
     */
45
    public function getId()
46
    {
47
        return $this->id;
48
    }
49
50
    /**
51
     * Set name
52
     *
53
     * @param string $name
54
     *
55
     * @return Category
56
     */
57
    public function setName($name)
58
    {
59
        $this->name = $name;
60
61
        return $this;
62
    }
63
64
    /**
65
     * Get name
66
     *
67
     * @return string
68
     */
69
    public function getName()
70
    {
71
        return $this->name;
72
    }
73
74
    /**
75
     * @return string
76
     */
77
    public function __toString()
78
    {
79
        return (string) $this->getName();
80
    }
81
82
    /**
83
     * Add client
84
     *
85
     * @param \ClientBundle\Entity\Client $client
86
     *
87
     * @return Category
88
     */
89
    public function addClient(\ClientBundle\Entity\Client $client)
90
    {
91
        $this->clients[] = $client;
92
93
        return $this;
94
    }
95
96
    /**
97
     * Remove client
98
     *
99
     * @param \ClientBundle\Entity\Client $client
100
     */
101
    public function removeClient(\ClientBundle\Entity\Client $client)
102
    {
103
        $this->clients->removeElement($client);
104
    }
105
106
    /**
107
     * Get clients
108
     *
109
     * @return \Doctrine\Common\Collections\Collection
110
     */
111
    public function getClients()
112
    {
113
        return $this->clients;
114
    }
115
}
116