1 | <?php |
||
15 | class Post |
||
16 | { |
||
17 | /** |
||
18 | * @var int Id |
||
19 | * @Id @Column(type="integer") @GeneratedValue |
||
20 | */ |
||
21 | protected $id; |
||
22 | |||
23 | /** |
||
24 | * @var string Title |
||
25 | * @Column(type="string") |
||
26 | */ |
||
27 | protected $title; |
||
28 | |||
29 | /** |
||
30 | * @var string Slug |
||
31 | * @Column(type="string", unique=true) |
||
32 | */ |
||
33 | protected $slug; |
||
34 | |||
35 | /** |
||
36 | * @var string Content |
||
37 | * @Column(type="text") |
||
38 | */ |
||
39 | protected $content; |
||
40 | |||
41 | /** |
||
42 | * @var DateTime Published at |
||
43 | * @Column(type="datetime") |
||
44 | */ |
||
45 | protected $published_at; |
||
46 | |||
47 | /** |
||
48 | * @var Category Category |
||
49 | * @ManyToOne(targetEntity="Category", inversedBy="posts") |
||
50 | */ |
||
51 | protected $category; |
||
52 | |||
53 | /** |
||
54 | * @var ArrayCollection Tags |
||
55 | * @ManyToMany(targetEntity="Tag", inversedBy="posts", cascade={"persist"}) |
||
56 | */ |
||
57 | protected $tags; |
||
58 | |||
59 | public function __construct() |
||
63 | |||
64 | public function getId() |
||
68 | |||
69 | public function getTitle() |
||
73 | |||
74 | public function setTitle($title) |
||
78 | |||
79 | public function getSlug() |
||
83 | |||
84 | public function setSlug($slug) |
||
88 | |||
89 | public function getContent() |
||
93 | |||
94 | public function getShortContent() |
||
98 | |||
99 | public function setContent($content) |
||
103 | |||
104 | public function getPublishedAt() |
||
108 | |||
109 | public function setPublishedAt(DateTime $published_at) |
||
113 | |||
114 | public function setCategory($category) |
||
118 | |||
119 | public function getCategory() |
||
123 | |||
124 | public function getTags() |
||
128 | |||
129 | public function addTag(Tag $tag) |
||
133 | } |
||
134 |