Completed
Push — master ( 392874...829d42 )
by Albert
05:23
created

Tag::getPosts()   A

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")
21
     */
22
    protected $name;
23
24
    /**
25
     * @var string Slug
26
     * @Column(type="string", unique=true)
27
     */
28
    protected $slug;
29
30
    /**
31
     * @var ArrayCollection Posts
32
     * @ManyToMany(targetEntity="Post", mappedBy="tags")
33
     */
34
    protected $posts;
35
36
    public function __construct()
37
    {
38
        $this->posts = new ArrayCollection;
39
    }
40
41
    public function getId()
42
    {
43
        return $this->id;
44
    }
45
46
    public function getName()
47
    {
48
        return $this->name;
49
    }
50
51
    public function setName($name)
52
    {
53
        $this->name = $name;
54
    }
55
56
    public function getSlug()
57
    {
58
        return $this->slug;
59
    }
60
61
    public function setSlug($slug)
62
    {
63
        $this->slug = $slug;
64
    }
65
66
    public function getPosts()
67
    {
68
        return $this->posts;
69
    }
70
}
71