1 | <?php |
||
13 | class PostRepository extends EntityRepository |
||
14 | { |
||
15 | const DIRECTION_PREVIOUS = 'previous'; |
||
16 | const DIRECTION_NEXT = 'next'; |
||
17 | |||
18 | /** |
||
19 | * @return \DateTime|null |
||
20 | */ |
||
21 | public function getLastPublishedPostDate() |
||
29 | |||
30 | /** |
||
31 | * @param int $count |
||
32 | * @param Category|null $category |
||
33 | * @param Tag|null $tag |
||
34 | * |
||
35 | * @return Post[] |
||
36 | */ |
||
37 | public function getLastPublishedPosts($count = 3, $category = null, $tag = null) |
||
59 | |||
60 | /** |
||
61 | * @param Category|null $category |
||
62 | * @param Tag|null $tag |
||
63 | * @return Post|null |
||
64 | */ |
||
65 | public function getLastPublishedPost($category = null, $tag = null) |
||
75 | |||
76 | /** |
||
77 | * @param Post|null $post |
||
78 | * @param Category|null $category |
||
79 | * @param Tag|null $tag |
||
80 | * |
||
81 | * @return Post|null |
||
82 | */ |
||
83 | public function getPreviousPost(Post $post = null, $category = null, $tag = null) |
||
87 | |||
88 | /** |
||
89 | * @param Post|null $post |
||
90 | * @param Category|null $category |
||
91 | * @param Tag|null $tag |
||
92 | * |
||
93 | * @return Post|null |
||
94 | */ |
||
95 | public function getNextPost(Post $post = null, $category = null, $tag = null) |
||
99 | |||
100 | /** |
||
101 | * @param Post|null $post |
||
102 | * @param string $direction |
||
103 | * @param Category|null $category |
||
104 | * @param Tag|null $tag |
||
105 | * |
||
106 | * @return Post|null |
||
107 | */ |
||
108 | protected function getClosestPost(Post $post = null, $direction = 'next', $category = null, $tag = null) |
||
147 | } |
||
148 |