Tag   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 25%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 62
ccs 3
cts 12
cp 0.25
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 4 1
A getId() 0 4 1
A getPosts() 0 4 1
A setPosts() 0 6 1
1
<?php
2
3
namespace Smart\ContentBundle\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Smart\ContentBundle\Entity\Traits\NameableTrait;
8
use Smart\ContentBundle\Entity\Traits\SeoTrait;
9
use Symfony\Component\Validator\Constraints as Assert;
10
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
11
12
/**
13
 * @ORM\Entity(repositoryClass="Smart\ContentBundle\Entity\Repository\TagRepository")
14
 * @ORM\Table(name="smart_content_tag")
15
 *
16
 * @UniqueEntity({"name"})
17
 * @UniqueEntity({"url"})
18
 */
19
class Tag
20
{
21
    use NameableTrait;
22
    use SeoTrait;
23
    
24
    /**
25
     * @var int
26
     *
27
     * @ORM\Id
28
     * @ORM\Column(name="id", type="integer")
29
     * @ORM\GeneratedValue(strategy="AUTO")
30
     */
31
    protected $id;
32
33
    /**
34
     * @var ArrayCollection|Post[]
35
     *
36
     * @ORM\ManyToMany(targetEntity="Smart\ContentBundle\Entity\Post", mappedBy="tags")
37
     */
38
    protected $posts;
39
40 1
    public function __construct()
41
    {
42 1
        $this->posts = new ArrayCollection();
43 1
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function __toString()
49
    {
50
        return (string) $this->getName();
51
    }
52
53
    /**
54
     * @return int
55
     */
56
    public function getId()
57
    {
58
        return $this->id;
59
    }
60
61
    /**
62
     * @return ArrayCollection|Post[]
63
     */
64
    public function getPosts()
65
    {
66
        return $this->posts;
67
    }
68
69
    /**
70
     * @param ArrayCollection|Post[] $posts
71
     *
72
     * @return $this
73
     */
74
    public function setPosts($posts)
75
    {
76
        $this->posts = $posts;
77
78
        return $this;
79
    }
80
}
81