Completed
Push — master ( ae5e03...0447ee )
by Jeroen
10:35 queued 04:37
created

src/Kunstmaan/TaggingBundle/Entity/Tag.php (2 issues)

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 Kunstmaan\TaggingBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use DoctrineExtensions\Taggable\Entity\Tag as BaseTag;
7
use Gedmo\Mapping\Annotation as Gedmo;
8
use Gedmo\Translatable\Translatable;
9
use Kunstmaan\TaggingBundle\Form\TagAdminType;
10
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
11
12
/**
13
 * @ORM\Entity(repositoryClass="Kunstmaan\TaggingBundle\Repository\TagRepository")
14
 * @ORM\Table(name="kuma_tags")
15
 * @UniqueEntity("name")
16
 */
17
class Tag extends BaseTag implements Translatable
18
{
19
    /**
20
     * @ORM\Id
21
     * @ORM\Column(type="bigint")
22
     * @ORM\GeneratedValue(strategy="AUTO")
23
     */
24
    protected $id;
25
26
    /**
27
     * @Gedmo\Translatable()
28
     * @ORM\Column(name="name", type="string", unique=true)
29
     */
30
    protected $name;
31
32
    /**
33
     * @Gedmo\Timestampable(on="create")
34
     * @ORM\Column(name="created_at", type="datetime")
35
     */
36
    protected $createdAt;
37
38
    /**
39
     * @Gedmo\Timestampable(on="update")
40
     * @ORM\Column(name="updated_at", type="datetime")
41
     */
42
    protected $updatedAt;
43
44
    /**
45
     * @ORM\OneToMany(targetEntity="Kunstmaan\TaggingBundle\Entity\Tagging", mappedBy="tag", fetch="LAZY")
46
     */
47
    protected $tagging;
48
49
    /**
50
     * @var string
51
     *
52
     * @Gedmo\Locale
53
     * Used locale to override Translation listener`s locale
54
     * this is not a mapped field of entity metadata, just a simple property
55
     */
56
    protected $locale;
57
58
    /**
59
     * Get id
60
     *
61
     * @return int
62
     */
63 1
    public function getId()
64
    {
65 1
        return $this->id;
66
    }
67
68
    /**
69
     * Set id
70
     *
71
     * @param int $id The unique identifier
72
     */
73 1
    public function setId($id)
74
    {
75 1
        $this->id = $id;
76 1
    }
77
78
    /**
79
     * Set name
80
     *
81
     * @param string $name
82
     */
83 10
    public function setName($name)
84
    {
85 10
        $this->name = $name;
86 10
    }
87
88
    /**
89
     * Get name
90
     *
91
     * @return string
92
     */
93 1
    public function getName()
94
    {
95 1
        return $this->name;
96
    }
97
98
    /**
99
     * set createdAt
100
     *
101
     * @param $createdAt
102
     */
103 10
    public function setCreatedAt(\DateTime $createdAt)
104
    {
105 10
        $this->createdAt = $createdAt;
106 10
    }
107
108
    /**
109
     * Get createdAt
110
     *
111
     * @return datetime
0 ignored issues
show
Should the return type not be \DateTime?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
112
     */
113 1
    public function getCreatedAt()
114
    {
115 1
        return $this->createdAt;
116
    }
117
118
    /**
119
     * Set UpdatedAt
120
     *
121
     * @param $updatedAt
122
     */
123 10
    public function setUpdatedAt(\DateTime $updatedAt)
124
    {
125 10
        $this->updatedAt = $updatedAt;
126 10
    }
127
128
    /**
129
     * Get updatedAt
130
     *
131
     * @return \DateTime
132
     */
133 1
    public function getUpdatedAt()
134
    {
135 1
        return $this->updatedAt;
136
    }
137
138
    /**
139
     * @return string
140
     */
141 1
    public function getTranslatableLocale()
142
    {
143 1
        return $this->locale;
144
    }
145
146
    /**
147
     * @param string $locale
148
     *
149
     * @return Tag
150
     */
151 1
    public function setTranslatableLocale($locale)
152
    {
153 1
        $this->locale = $locale;
154
155 1
        return $this;
156
    }
157
158 1
    public function getDefaultAdminType()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
159
    {
160 1
        return TagAdminType::class;
161
    }
162
163 1
    public function __toString()
164
    {
165 1
        return $this->getName();
166
    }
167
}
168