Total Complexity | 11 |
Total Lines | 74 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | class Category |
||
13 | { |
||
14 | /** |
||
15 | * @ORM\Id() |
||
16 | * @ORM\GeneratedValue() |
||
17 | * @ORM\Column(type="integer") |
||
18 | */ |
||
19 | private $id; |
||
20 | |||
21 | /** |
||
22 | * @ORM\Column(type="string", length=255) |
||
23 | */ |
||
24 | private $Name; |
||
25 | |||
26 | /** |
||
27 | * @ORM\OneToMany(targetEntity="App\Entity\Trick", mappedBy="category") |
||
28 | */ |
||
29 | private $tricks; |
||
30 | |||
31 | public function __construct() |
||
32 | { |
||
33 | $this->tricks = new ArrayCollection(); |
||
34 | } |
||
35 | |||
36 | public function getId(): ?int |
||
37 | { |
||
38 | return $this->id; |
||
39 | } |
||
40 | |||
41 | public function getName(): ?string |
||
42 | { |
||
43 | return $this->Name; |
||
44 | } |
||
45 | |||
46 | public function setName(string $Name): self |
||
47 | { |
||
48 | $this->Name = $Name; |
||
49 | |||
50 | return $this; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return Collection|Trick[] |
||
55 | */ |
||
56 | public function getTricks(): Collection |
||
57 | { |
||
58 | return $this->tricks; |
||
59 | } |
||
60 | |||
61 | public function addTrick(Trick $trick): self |
||
62 | { |
||
63 | if (!$this->tricks->contains($trick)) { |
||
64 | $this->tricks[] = $trick; |
||
65 | $trick->setCategory($this); |
||
66 | } |
||
67 | |||
68 | return $this; |
||
69 | } |
||
70 | |||
71 | public function removeTrick(Trick $trick): self |
||
82 | } |
||
83 | |||
84 | public function __toString(){ |
||
85 | return $this->Name; |
||
86 | } |
||
87 | } |
||
88 |