diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-08-23 11:51:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-23 11:51:13 +0200 |
commit | 1bee9e0760c89756ebab0b67f9ab7efc5c6a709b (patch) | |
tree | cd6200f084675195aaa5789a3d0e1297eca1a94a /src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php | |
parent | 79efca1e6ff28362d4bd2713f68205294cdd07de (diff) | |
parent | 97e7ad4dc7bfc26cea334bc880a39e388d6848f3 (diff) | |
download | wallabag-1bee9e0760c89756ebab0b67f9ab7efc5c6a709b.tar.gz wallabag-1bee9e0760c89756ebab0b67f9ab7efc5c6a709b.tar.zst wallabag-1bee9e0760c89756ebab0b67f9ab7efc5c6a709b.zip |
Merge pull request #2218 from wallabag/api-delete-tags-1982
Delete tag or tags by label
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php new file mode 100644 index 00000000..f9066bee --- /dev/null +++ b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php | |||
@@ -0,0 +1,34 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Helper; | ||
4 | |||
5 | use Pagerfanta\Adapter\AdapterInterface; | ||
6 | use Pagerfanta\Pagerfanta; | ||
7 | use Symfony\Component\Routing\Router; | ||
8 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; | ||
9 | |||
10 | class PreparePagerForEntries | ||
11 | { | ||
12 | private $user; | ||
13 | private $router; | ||
14 | |||
15 | public function __construct(TokenStorage $token, Router $router) | ||
16 | { | ||
17 | $this->user = $token->getToken()->getUser(); | ||
18 | $this->router = $router; | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * @param AdapterInterface $adapter | ||
23 | * @param int $page | ||
24 | * | ||
25 | * @return null|Pagerfanta | ||
26 | */ | ||
27 | public function prepare(AdapterInterface $adapter, $page = 1) | ||
28 | { | ||
29 | $entries = new Pagerfanta($adapter); | ||
30 | $entries->setMaxPerPage($this->user->getConfig()->getItemsPerPage()); | ||
31 | |||
32 | return $entries; | ||
33 | } | ||
34 | } | ||