1 | <?php |
||
24 | class Post |
||
25 | { |
||
26 | use ContentTrait; |
||
27 | use SeoTrait; |
||
28 | use ImageTrait; |
||
29 | |||
30 | /** |
||
31 | * @var int |
||
32 | * |
||
33 | * @ORM\Id |
||
34 | * @ORM\Column(name="id", type="integer") |
||
35 | * @ORM\GeneratedValue(strategy="AUTO") |
||
36 | */ |
||
37 | protected $id; |
||
38 | |||
39 | /** |
||
40 | * @var \DateTime |
||
41 | * |
||
42 | * @ORM\Column(name="published_at", type="datetime", nullable=true) |
||
43 | */ |
||
44 | protected $publishedAt; |
||
45 | |||
46 | /** |
||
47 | * @var Author |
||
48 | * |
||
49 | * @ORM\ManyToOne(targetEntity="Smart\ContentBundle\Entity\Author") |
||
50 | */ |
||
51 | protected $author; |
||
52 | |||
53 | /** |
||
54 | * @var Category |
||
55 | * |
||
56 | * @ORM\ManyToOne(targetEntity="Smart\ContentBundle\Entity\Category", inversedBy="posts") |
||
57 | * @Assert\NotNull() |
||
58 | */ |
||
59 | protected $category; |
||
60 | |||
61 | /** |
||
62 | * @var ArrayCollection|Tag[] |
||
63 | * |
||
64 | * @ORM\ManyToMany(targetEntity="Smart\ContentBundle\Entity\Tag", inversedBy="posts") |
||
65 | */ |
||
66 | protected $tags; |
||
67 | |||
68 | 1 | public function __construct() |
|
73 | |||
74 | /** |
||
75 | * @return string |
||
76 | */ |
||
77 | public function __toString() |
||
81 | |||
82 | /** |
||
83 | * @return int |
||
84 | */ |
||
85 | public function getId() |
||
89 | |||
90 | /** |
||
91 | * @return \DateTime|null |
||
92 | */ |
||
93 | public function getPublishedAt() |
||
97 | |||
98 | /** |
||
99 | * @param \DateTime $publishedAt |
||
100 | * |
||
101 | * @return $this |
||
102 | */ |
||
103 | public function setPublishedAt($publishedAt) |
||
109 | |||
110 | /** |
||
111 | * @return Author |
||
112 | */ |
||
113 | public function getAuthor() |
||
117 | |||
118 | /** |
||
119 | * @param Author $author |
||
120 | * |
||
121 | * @return $this |
||
122 | */ |
||
123 | 1 | public function setAuthor($author) |
|
129 | |||
130 | /** |
||
131 | * @return Category |
||
132 | */ |
||
133 | public function getCategory() |
||
137 | |||
138 | /** |
||
139 | * @return string |
||
140 | */ |
||
141 | public function getCategoryUrl() |
||
145 | |||
146 | /** |
||
147 | * @param Category $category |
||
148 | * |
||
149 | * @return $this |
||
150 | */ |
||
151 | 1 | public function setCategory($category) |
|
157 | |||
158 | /** |
||
159 | * @return ArrayCollection|Tag[] |
||
160 | */ |
||
161 | public function getTags() |
||
165 | |||
166 | /** |
||
167 | * @param ArrayCollection|Tag[] $tags |
||
168 | * |
||
169 | * @return $this |
||
170 | */ |
||
171 | 1 | public function setTags($tags) |
|
179 | |||
180 | /** |
||
181 | * @param Tag $tag |
||
182 | * |
||
183 | * @return $this |
||
184 | */ |
||
185 | 1 | public function addTag($tag) |
|
193 | } |
||
194 |