1 | <?php |
||
11 | class Post |
||
12 | { |
||
13 | /** |
||
14 | * @var int Id |
||
15 | * @Id @Column(type="integer") @GeneratedValue |
||
16 | */ |
||
17 | protected $id; |
||
18 | |||
19 | /** |
||
20 | * @var string Title |
||
21 | * @Column(type="string") |
||
22 | */ |
||
23 | protected $title; |
||
24 | |||
25 | /** |
||
26 | * @var string Slug |
||
27 | * @Column(type="string", unique=true) |
||
28 | */ |
||
29 | protected $slug; |
||
30 | |||
31 | /** |
||
32 | * @var string Content |
||
33 | * @Column(type="text") |
||
34 | */ |
||
35 | protected $content; |
||
36 | |||
37 | /** |
||
38 | * @var DateTime Published at |
||
39 | * @Column(type="datetime") |
||
40 | */ |
||
41 | protected $published_at; |
||
42 | |||
43 | /** |
||
44 | * @var Category Category |
||
45 | * @ManyToOne(targetEntity="Category", inversedBy="posts") |
||
46 | */ |
||
47 | protected $category; |
||
48 | |||
49 | /** |
||
50 | * @var ArrayCollection Tags |
||
51 | * @ManyToMany(targetEntity="Tag", cascade={"persist"}) |
||
52 | */ |
||
53 | protected $tags; |
||
54 | |||
55 | public function __construct() |
||
59 | |||
60 | public function getId() |
||
64 | |||
65 | public function getTitle() |
||
69 | |||
70 | public function setTitle($title) |
||
74 | |||
75 | public function getSlug() |
||
79 | |||
80 | public function setSlug($slug) |
||
84 | |||
85 | public function getContent() |
||
89 | |||
90 | public function getShortContent() |
||
94 | |||
95 | public function setContent($content) |
||
99 | |||
100 | public function getPublishedAt() |
||
104 | |||
105 | public function setPublishedAt(DateTime $published_at) |
||
109 | |||
110 | public function setCategory($category) |
||
114 | |||
115 | public function getCategory() |
||
119 | |||
120 | public function getTags() |
||
124 | |||
125 | public function addTag(Tag $tag) |
||
129 | } |
||
130 |