Tag::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Albert221\Blog\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
7
/**
8
 * @Entity(repositoryClass="\Albert221\Blog\Repository\Database\TagRepository") @Table(name="tags")
9
 */
10
class Tag
11
{
12
    /**
13
     * @var int Id
14
     * @Id @Column(type="integer") @GeneratedValue
15
     */
16
    protected $id;
17
18
    /**
19
     * @var string Name
20
     * @Column(type="string", unique=true)
21
     */
22
    protected $name;
23
24
    /**
25
     * @var ArrayCollection Posts
26
     * @ManyToMany(targetEntity="Post", mappedBy="tags")
27
     */
28
    protected $posts;
29
30
    public function __construct()
31
    {
32
        $this->posts = new ArrayCollection;
33
    }
34
35
    public function getId()
36
    {
37
        return $this->id;
38
    }
39
40
    public function getName()
41
    {
42
        return $this->name;
43
    }
44
45
    public function setName($name)
46
    {
47
        $this->name = $name;
48
    }
49
50
    public function getPosts()
51
    {
52
        return $this->posts;
53
    }
54
}
55