1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Entity; |
4
|
|
|
|
5
|
|
|
use App\Traits\TimestampableTrait; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
8
|
|
|
use JMS\Serializer\Annotation as Serializer; |
9
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
10
|
|
|
use Gedmo\Blameable\Traits\BlameableEntity; |
11
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface; |
12
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @ORM\MappedSuperclass |
16
|
|
|
*/ |
17
|
|
|
abstract class AbstractTranslateableStory extends AbstractPersonalTranslatable implements TranslatableInterface |
18
|
|
|
{ |
19
|
|
|
use TimestampableTrait, BlameableEntity; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var string |
23
|
|
|
* |
24
|
|
|
* @Gedmo\Translatable |
25
|
|
|
* @Assert\NotBlank() |
26
|
|
|
* @ORM\Column(type="string", length=255) |
27
|
|
|
* @Serializer\Type("string") |
28
|
|
|
* @Serializer\Expose |
29
|
|
|
*/ |
30
|
|
|
protected $title; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string |
34
|
|
|
* |
35
|
|
|
* @Gedmo\Translatable |
36
|
|
|
* @ORM\Column(type="text", nullable=true) |
37
|
|
|
* @Serializer\Type("string") |
38
|
|
|
* @Serializer\Expose |
39
|
|
|
*/ |
40
|
|
|
protected $shortDescription; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string |
44
|
|
|
* |
45
|
|
|
* @Gedmo\Translatable |
46
|
|
|
* @ORM\Column(type="text", nullable=true) |
47
|
|
|
* @Serializer\Type("string") |
48
|
|
|
* @Serializer\Expose |
49
|
|
|
*/ |
50
|
|
|
protected $text; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var \App\Entity\Media |
54
|
|
|
* |
55
|
|
|
* @ORM\OneToOne(targetEntity="App\Entity\Media", cascade={"persist"}) |
56
|
|
|
* @ORM\JoinColumn(name="mainPicture_id", referencedColumnName="id") |
57
|
|
|
*/ |
58
|
|
|
protected $mainPicture; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var array |
62
|
|
|
* |
63
|
|
|
* @Serializer\Expose |
64
|
|
|
* @Serializer\Type("array") |
65
|
|
|
* @Serializer\SerializedName("mainPicture") |
66
|
|
|
*/ |
67
|
|
|
public $mainPictureThumbnails; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var array |
71
|
|
|
* |
72
|
|
|
* @Serializer\Expose |
73
|
|
|
* @Serializer\Type("array") |
74
|
|
|
* @Serializer\SerializedName("gallery") |
75
|
|
|
*/ |
76
|
|
|
public $galleryHasMediaThumbnails; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @var string |
80
|
|
|
* |
81
|
|
|
* @Gedmo\Slug(fields={"title"}) |
82
|
|
|
* @ORM\Column(name="slug", type="string", length=255) |
83
|
|
|
* @Serializer\Type("string") |
84
|
|
|
* @Serializer\Expose |
85
|
|
|
*/ |
86
|
|
|
protected $slug; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Set title |
90
|
|
|
* |
91
|
|
|
* @param string $title |
92
|
|
|
* @return $this |
93
|
|
|
*/ |
94
|
1 |
|
public function setTitle($title) |
95
|
|
|
{ |
96
|
1 |
|
$this->title = $title; |
97
|
|
|
|
98
|
1 |
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Get title |
103
|
|
|
* |
104
|
|
|
* @return string |
105
|
|
|
*/ |
106
|
9 |
|
public function getTitle() |
107
|
|
|
{ |
108
|
9 |
|
return $this->title; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Set shortDescription |
113
|
|
|
* |
114
|
|
|
* @param string $shortDescription |
115
|
|
|
* @return self |
116
|
|
|
*/ |
117
|
|
|
public function setShortDescription($shortDescription) |
118
|
|
|
{ |
119
|
|
|
$this->shortDescription = $shortDescription; |
120
|
|
|
|
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Get shortDescription |
126
|
|
|
* |
127
|
|
|
* @return string |
128
|
|
|
*/ |
129
|
1 |
|
public function getShortDescription() |
130
|
|
|
{ |
131
|
1 |
|
return $this->shortDescription; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Set text |
136
|
|
|
* |
137
|
|
|
* @param string $text |
138
|
|
|
* @return self |
139
|
|
|
*/ |
140
|
1 |
|
public function setText($text) |
141
|
|
|
{ |
142
|
1 |
|
$this->text = $text; |
143
|
|
|
|
144
|
1 |
|
return $this; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* Get text |
149
|
|
|
* |
150
|
|
|
* @return string |
151
|
|
|
*/ |
152
|
2 |
|
public function getText() |
153
|
|
|
{ |
154
|
2 |
|
return $this->text; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Set slug |
159
|
|
|
* |
160
|
|
|
* @param string $slug |
161
|
|
|
* @return self |
162
|
|
|
*/ |
163
|
|
|
public function setSlug($slug) |
164
|
|
|
{ |
165
|
|
|
$this->slug = $slug; |
166
|
|
|
|
167
|
|
|
return $this; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Get slug |
172
|
|
|
* |
173
|
|
|
* @return string |
174
|
|
|
*/ |
175
|
2 |
|
public function getSlug() |
176
|
|
|
{ |
177
|
2 |
|
return $this->slug; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* Set mainPicture |
182
|
|
|
* |
183
|
|
|
* @param \App\Entity\Media $mainPicture |
184
|
|
|
* @return self |
185
|
|
|
*/ |
186
|
|
|
public function setMainPicture(\App\Entity\Media $mainPicture = null) |
187
|
|
|
{ |
188
|
|
|
$this->mainPicture = $mainPicture; |
189
|
|
|
|
190
|
|
|
return $this; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* Get mainPicture |
195
|
|
|
* |
196
|
|
|
* @return \App\Entity\Media |
197
|
|
|
*/ |
198
|
12 |
|
public function getMainPicture() |
199
|
|
|
{ |
200
|
12 |
|
return $this->mainPicture; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @return string |
205
|
|
|
*/ |
206
|
5 |
|
public function __toString() |
207
|
|
|
{ |
208
|
5 |
|
return $this->getTitle(); |
209
|
|
|
} |
210
|
|
|
} |
211
|
|
|
|