| Total Complexity | 8 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class Tag |
||
| 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\ManyToMany(targetEntity=Post::class, mappedBy="tags") |
||
| 28 | */ |
||
| 29 | private $posts; |
||
| 30 | |||
| 31 | public function __construct() |
||
| 32 | { |
||
| 33 | $this->posts = new ArrayCollection(); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function getName(): ?string |
||
| 37 | { |
||
| 38 | return $this->name; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function setName($name) |
||
| 44 | } |
||
| 45 | |||
| 46 | public function getPosts() |
||
| 49 | } |
||
| 50 | |||
| 51 | public function addPost(Post $post) |
||
| 52 | { |
||
| 53 | if (!$this->posts->contains($post)) { |
||
| 54 | $this->posts[] = $post; |
||
| 55 | $post->addTag($this); |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | public function removePost(Post $post) |
||
| 64 | } |
||
| 65 | } |
||
| 66 | } |
||
| 67 |