1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Victoire\Bundle\BlogBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
7
|
|
|
use JMS\Serializer\Annotation as Serializer; |
8
|
|
|
use Knp\DoctrineBehaviors\Model\Translatable\Translation; |
9
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
10
|
|
|
use Victoire\Bundle\CoreBundle\Annotations as VIC; |
11
|
|
|
use Victoire\Bundle\MediaBundle\Entity\Media; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Victoire ViewTranslation. |
15
|
|
|
* |
16
|
|
|
* @ORM\Entity() |
17
|
|
|
* @ORM\Table(name="vic_article_translations") |
18
|
|
|
*/ |
19
|
|
|
class ArticleTranslation |
20
|
|
|
{ |
21
|
|
|
use Translation; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
* |
26
|
|
|
* @Assert\NotBlank() |
27
|
|
|
* @ORM\Column(name="name", type="string", length=255) |
28
|
|
|
* @Serializer\Groups({"search"}) |
29
|
|
|
* @VIC\BusinessProperty({"textable", "seoable"}) |
30
|
|
|
*/ |
31
|
|
|
protected $name; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
* |
36
|
|
|
* @Assert\NotBlank(groups={"edition"}) |
37
|
|
|
* @Gedmo\Slug(handlers={ |
38
|
|
|
* @Gedmo\SlugHandler(class="Victoire\Bundle\BusinessEntityBundle\Handler\TwigSlugHandler" |
39
|
|
|
* )},fields={"name"}, updatable=false, unique=false) |
40
|
|
|
* @ORM\Column(name="slug", type="string", length=255) |
41
|
|
|
* @VIC\BusinessProperty("businessParameter") |
42
|
|
|
*/ |
43
|
|
|
protected $slug; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var string |
47
|
|
|
* |
48
|
|
|
* @ORM\ManyToOne(targetEntity="\Victoire\Bundle\MediaBundle\Entity\Media") |
49
|
|
|
* @ORM\JoinColumn(name="image_id", referencedColumnName="id", onDelete="CASCADE") |
50
|
|
|
* @VIC\BusinessProperty("imageable") |
51
|
|
|
*/ |
52
|
|
|
private $image; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var string |
56
|
|
|
* |
57
|
|
|
* @ORM\Column(name="description", type="text", nullable=true) |
58
|
|
|
* @VIC\BusinessProperty({"textable", "seoable"}) |
59
|
|
|
*/ |
60
|
|
|
private $description; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get name. |
64
|
|
|
* |
65
|
|
|
* @return string |
66
|
|
|
*/ |
67
|
|
|
public function getName() |
68
|
|
|
{ |
69
|
|
|
return $this->name; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Set name. |
74
|
|
|
* |
75
|
|
|
* @param string $name |
76
|
|
|
* |
77
|
|
|
* @return View |
78
|
|
|
*/ |
79
|
|
|
public function setName($name) |
80
|
|
|
{ |
81
|
|
|
$this->name = $name; |
82
|
|
|
|
83
|
|
|
return $this; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Set slug. |
88
|
|
|
* |
89
|
|
|
* @param string $slug |
90
|
|
|
* |
91
|
|
|
* @return View |
92
|
|
|
*/ |
93
|
|
|
public function setSlug($slug) |
94
|
|
|
{ |
95
|
|
|
$this->slug = $slug; |
96
|
|
|
|
97
|
|
|
return $this; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Get slug. |
102
|
|
|
* |
103
|
|
|
* @return string |
104
|
|
|
*/ |
105
|
|
|
public function getSlug() |
106
|
|
|
{ |
107
|
|
|
return $this->slug; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Get description. |
112
|
|
|
* |
113
|
|
|
* @return string |
114
|
|
|
*/ |
115
|
|
|
public function getDescription() |
116
|
|
|
{ |
117
|
|
|
return $this->description; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
|
|
|
|
121
|
|
|
* Set category. |
122
|
|
|
* |
123
|
|
|
* @param string $category |
|
|
|
|
124
|
|
|
* |
125
|
|
|
* @return Article |
126
|
|
|
*/ |
127
|
|
|
public function setDescription($description) |
128
|
|
|
{ |
129
|
|
|
$this->description = $description; |
130
|
|
|
|
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Set image. |
136
|
|
|
* |
137
|
|
|
* @param Media $image |
138
|
|
|
* |
139
|
|
|
* @return ArticleTranslation |
140
|
|
|
*/ |
141
|
|
|
public function setImage(Media $image = null) |
142
|
|
|
{ |
143
|
|
|
$this->image = $image; |
|
|
|
|
144
|
|
|
|
145
|
|
|
return $this; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Get image. |
150
|
|
|
* |
151
|
|
|
* @return string |
152
|
|
|
*/ |
153
|
|
|
public function getImage() |
154
|
|
|
{ |
155
|
|
|
return $this->image; |
156
|
|
|
} |
157
|
|
|
} |
158
|
|
|
|