1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Entity; |
4
|
|
|
|
5
|
|
|
use AppBundle\Traits\DeletedByTrait; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
8
|
|
|
use JMS\Serializer\Annotation as Serializer; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @ORM\Table(name="posts") |
12
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\PostRepository") |
13
|
|
|
* @Gedmo\TranslationEntity(class="AppBundle\Entity\Translations\PostTranslation") |
14
|
|
|
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false) |
15
|
|
|
* @Serializer\ExclusionPolicy("all") |
16
|
|
|
*/ |
17
|
|
|
class Post extends AbstractTranslateableStory |
18
|
|
|
{ |
19
|
|
|
use DeletedByTrait; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var integer |
23
|
|
|
* |
24
|
|
|
* @ORM\Column(name="id", type="integer") |
25
|
|
|
* @ORM\Id |
26
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
27
|
|
|
*/ |
28
|
|
|
protected $id; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var \Doctrine\Common\Collections\Collection |
32
|
|
|
* |
33
|
|
|
* @ORM\OneToMany( |
34
|
|
|
* targetEntity="AppBundle\Entity\Translations\PostTranslation", |
35
|
|
|
* mappedBy="object", |
36
|
|
|
* cascade={"persist", "remove"} |
37
|
|
|
* ) |
38
|
|
|
*/ |
39
|
|
|
protected $translations; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var \Application\Sonata\MediaBundle\Entity\GalleryHasMedia |
43
|
|
|
* |
44
|
|
|
* @ORM\ManyToMany(targetEntity="Application\Sonata\MediaBundle\Entity\GalleryHasMedia", cascade={"persist"}) |
45
|
|
|
* @ORM\JoinTable(name="post_galleryHasMedia", |
46
|
|
|
* joinColumns={@ORM\JoinColumn(name="post_id",referencedColumnName="id")}, |
47
|
|
|
* inverseJoinColumns={@ORM\JoinColumn(name="galleryHasMedia_id",referencedColumnName="id")} |
48
|
|
|
* ) |
49
|
|
|
*/ |
50
|
|
|
protected $galleryHasMedia; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* \Doctrine\Common\Collections\Collection |
54
|
|
|
* |
55
|
|
|
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\Tag", inversedBy="posts", cascade={"persist"}) |
56
|
|
|
* @Serializer\Expose |
57
|
|
|
*/ |
58
|
|
|
protected $tags; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var bool |
62
|
|
|
* |
63
|
|
|
* @ORM\Column(name="pinned", type="boolean") |
64
|
|
|
* @Serializer\Type("boolean") |
65
|
|
|
* @Serializer\Expose |
66
|
|
|
*/ |
67
|
|
|
protected $pinned = false; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Constructor |
71
|
|
|
*/ |
72
|
|
|
public function __construct() |
73
|
|
|
{ |
74
|
|
|
parent::__construct(); |
75
|
|
|
$this->galleryHasMedia = new \Doctrine\Common\Collections\ArrayCollection(); |
|
|
|
|
76
|
|
|
$this->tags = new \Doctrine\Common\Collections\ArrayCollection(); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Get id |
81
|
|
|
* |
82
|
|
|
* @return integer |
83
|
|
|
*/ |
84
|
1 |
|
public function getId() |
85
|
|
|
{ |
86
|
1 |
|
return $this->id; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Unset translations |
91
|
|
|
* |
92
|
|
|
* @return Post |
93
|
|
|
*/ |
94
|
4 |
|
public function unsetTranslations() |
95
|
|
|
{ |
96
|
4 |
|
$this->translations = null; |
97
|
|
|
|
98
|
4 |
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Add galleryHasMedia |
103
|
|
|
* |
104
|
|
|
* @param \Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia |
105
|
|
|
* @return self |
106
|
|
|
*/ |
107
|
|
|
public function addGalleryHasMedia(\Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia) |
108
|
|
|
{ |
109
|
|
|
$this->galleryHasMedia[] = $galleryHasMedia; |
110
|
|
|
|
111
|
|
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Remove galleryHasMedia |
116
|
|
|
* |
117
|
|
|
* @param \Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia |
118
|
|
|
*/ |
119
|
|
|
public function removeGalleryHasMedia(\Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia) |
120
|
|
|
{ |
121
|
|
|
$this->galleryHasMedia->removeElement($galleryHasMedia); |
|
|
|
|
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Get galleryHasMedia |
126
|
|
|
* |
127
|
|
|
* @return \Doctrine\Common\Collections\Collection |
128
|
|
|
*/ |
129
|
5 |
|
public function getGalleryHasMedia() |
130
|
|
|
{ |
131
|
5 |
|
return $this->galleryHasMedia; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Add tags |
136
|
|
|
* |
137
|
|
|
* @param \AppBundle\Entity\Tag $tags |
138
|
|
|
* @return self |
139
|
|
|
*/ |
140
|
|
|
public function addTag(\AppBundle\Entity\Tag $tags) |
141
|
|
|
{ |
142
|
|
|
$this->tags[] = $tags; |
143
|
|
|
|
144
|
|
|
return $this; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* Remove tags |
149
|
|
|
* |
150
|
|
|
* @param \AppBundle\Entity\Tag $tags |
151
|
|
|
*/ |
152
|
|
|
public function removeTag(\AppBundle\Entity\Tag $tags) |
153
|
|
|
{ |
154
|
|
|
$this->tags->removeElement($tags); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Get tags |
159
|
|
|
* |
160
|
|
|
* @return \Doctrine\Common\Collections\Collection |
161
|
|
|
*/ |
162
|
4 |
|
public function getTags() |
163
|
|
|
{ |
164
|
4 |
|
return $this->tags; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @param boolean $pinned |
169
|
|
|
* @return Post |
170
|
|
|
*/ |
171
|
1 |
|
public function setPinned($pinned) |
172
|
|
|
{ |
173
|
1 |
|
$this->pinned = $pinned; |
174
|
|
|
|
175
|
1 |
|
return $this; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @return boolean |
180
|
|
|
*/ |
181
|
|
|
public function isPinned() |
182
|
|
|
{ |
183
|
|
|
return $this->pinned; |
184
|
|
|
} |
185
|
|
|
} |
186
|
|
|
|
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..