Test Failed
Push — develop ( 01b725...e43081 )
by Stone
04:47
created

Category::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\Common\Collections\Collection;
7
use Doctrine\ORM\Mapping as ORM;
8
9
/**
10
 * @ORM\Entity(repositoryClass="App\Repository\CategoryRepository")
11
 */
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
72
    {
73
        if ($this->tricks->contains($trick)) {
74
            $this->tricks->removeElement($trick);
75
            // set the owning side to null (unless already changed)
76
            if ($trick->getCategory() === $this) {
77
                $trick->setCategory(null);
78
            }
79
        }
80
81
        return $this;
82
    }
83
84
    public function __toString(){
85
        return $this->Name;
86
    }
87
}
88