Completed
Push — master ( a83b14...54219d )
by Yaroslav
18:18
created

src/Entity/Tag.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Harentius\BlogBundle\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Gedmo\Mapping\Annotation as Gedmo;
8
use Harentius\BlogBundle\Entity\Base\IdentifiableEntityTrait;
9
use Symfony\Component\Validator\Constraints as SymfonyConstraints;
10
11
/**
12
 * @ORM\Entity(repositoryClass="Harentius\BlogBundle\Entity\TagRepository")
13
 */
14
class Tag
15
{
16
    use IdentifiableEntityTrait;
17
18
    /**
19
     * @var string
20
     *
21
     * @ORM\Column(type="string", length=255)
22
     * @SymfonyConstraints\Type(type="string")
23
     * @SymfonyConstraints\Length(max=255)
24
     * @SymfonyConstraints\NotBlank()
25
     */
26
    private $name;
27
28
    /**
29
     * @var string
30
     *
31
     * @ORM\Column(type="string", length=255)
32
     * @Gedmo\Slug(fields={"name"}, unique=true)
33
     * @SymfonyConstraints\Type(type="string")
34
     * @SymfonyConstraints\Length(max=255)
35
     */
36
    private $slug;
37
38
    /**
39
     * @var Article[]
40
     *
41
     * @ORM\ManyToMany(
42
     *     targetEntity="Harentius\BlogBundle\Entity\Article",
43
     *     mappedBy="tags",
44
     * )
45
     */
46
    private $articles;
47
48
    /**
49
     *
50
     */
51
    public function __construct()
52
    {
53
        $this->articles = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type array<integer,object<Har...Bundle\Entity\Article>> of property $articles.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function __toString()
60
    {
61
        return $this->name;
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getName()
68
    {
69
        return $this->name;
70
    }
71
72
    /**
73
     * @param string $value
74
     * @return $this
75
     */
76
    public function setName($value)
77
    {
78
        $this->name = $value;
79
80
        return $this;
81
    }
82
83
    /**
84
     * @return string
85
     */
86
    public function getSlug()
87
    {
88
        return $this->slug;
89
    }
90
91
    /**
92
     * @param string $value
93
     * @return $this
94
     */
95
    public function setSlug($value)
96
    {
97
        $this->slug = $value;
98
99
        return $this;
100
    }
101
102
    /**
103
     * @return Article[]|ArrayCollection
104
     */
105
    public function getArticles()
106
    {
107
        return $this->articles;
108
    }
109
110
    /**
111
     * @param Article[] $value
112
     * @return $this
113
     */
114
    public function setArticles($value)
115
    {
116
        $this->articles = $value;
117
118
        return $this;
119
    }
120
}
121