mirror of https://github.com/wallabag/wallabag.git
Replaced TokenStorage with TokenStorageInterface
This commit is contained in:
parent
24692715de
commit
2fe2e411a7
|
@ -13,6 +13,7 @@ use Symfony\Component\Form\AbstractType;
|
|||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
class EntryFilterType extends AbstractType
|
||||
{
|
||||
|
@ -25,10 +26,15 @@ class EntryFilterType extends AbstractType
|
|||
* @param EntityRepository $entryRepository
|
||||
* @param TokenStorage $token
|
||||
*/
|
||||
public function __construct(EntityRepository $entryRepository, TokenStorage $token)
|
||||
public function __construct(EntityRepository $entryRepository, TokenStorageInterface $tokenStorage)
|
||||
{
|
||||
$this->repository = $entryRepository;
|
||||
$this->user = $token->getToken()->getUser();
|
||||
|
||||
$this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null;
|
||||
|
||||
if (null === $this->user || !is_object($this->user)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
|
|
|
@ -5,16 +5,16 @@ namespace Wallabag\CoreBundle\Helper;
|
|||
use Pagerfanta\Adapter\AdapterInterface;
|
||||
use Pagerfanta\Pagerfanta;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
class PreparePagerForEntries
|
||||
{
|
||||
private $user;
|
||||
private $router;
|
||||
private $tokenStorage;
|
||||
|
||||
public function __construct(TokenStorage $token, Router $router)
|
||||
public function __construct(TokenStorageInterface $tokenStorage, Router $router)
|
||||
{
|
||||
$this->user = $token->getToken()->getUser();
|
||||
$this->tokenStorage = $tokenStorage;
|
||||
$this->router = $router;
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,14 @@ class PreparePagerForEntries
|
|||
*/
|
||||
public function prepare(AdapterInterface $adapter, $page = 1)
|
||||
{
|
||||
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
|
||||
|
||||
if (null === $user || !is_object($user)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$entries = new Pagerfanta($adapter);
|
||||
$entries->setMaxPerPage($this->user->getConfig()->getItemsPerPage());
|
||||
$entries->setMaxPerPage($user->getConfig()->getItemsPerPage());
|
||||
|
||||
return $entries;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue