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 \DateTime |
||
84 | */ |
||
85 | public function getPublishedAt() |
||
89 | |||
90 | /** |
||
91 | * @param \DateTime $publishedAt |
||
92 | * |
||
93 | * @return $this |
||
94 | */ |
||
95 | public function setPublishedAt($publishedAt) |
||
101 | |||
102 | /** |
||
103 | * @return Author |
||
104 | */ |
||
105 | public function getAuthor() |
||
109 | |||
110 | /** |
||
111 | * @param Author $author |
||
112 | * |
||
113 | * @return $this |
||
114 | */ |
||
115 | 1 | public function setAuthor($author) |
|
121 | |||
122 | /** |
||
123 | * @return Category |
||
124 | */ |
||
125 | public function getCategory() |
||
129 | |||
130 | /** |
||
131 | * @return string |
||
132 | */ |
||
133 | public function getCategoryUrl() |
||
137 | |||
138 | /** |
||
139 | * @param Category $category |
||
140 | * |
||
141 | * @return $this |
||
142 | */ |
||
143 | 1 | public function setCategory($category) |
|
149 | |||
150 | /** |
||
151 | * @return ArrayCollection|Tag[] |
||
152 | */ |
||
153 | public function getTags() |
||
157 | |||
158 | /** |
||
159 | * @param ArrayCollection|Tag[] $tags |
||
160 | * |
||
161 | * @return $this |
||
162 | */ |
||
163 | 1 | public function setTags($tags) |
|
171 | |||
172 | /** |
||
173 | * @param Tag $tag |
||
174 | * |
||
175 | * @return $this |
||
176 | */ |
||
177 | 1 | public function addTag($tag) |
|
185 | } |
||
186 |