mirror of
https://github.com/wallabag/wallabag.git
synced 2025-01-31 07:47:28 +01:00
Fix recent update
- some missing url parameters from WallabagRestController & EntryController - use a service for `EntryFilterType` to use fully qualified name instead (so changing class signature) - update ImportBundle (url & form)
This commit is contained in:
parent
8ba854c068
commit
1d76102a24
@ -8,6 +8,7 @@ use Hateoas\Representation\Factory\PagerfantaFactory;
|
||||
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
|
||||
@ -84,7 +85,7 @@ class WallabagRestController extends FOSRestController
|
||||
$pagerfantaFactory = new PagerfantaFactory('page', 'perPage');
|
||||
$paginatedCollection = $pagerfantaFactory->createRepresentation(
|
||||
$pager,
|
||||
new Route('api_get_entries', [], $absolute = true)
|
||||
new Route('api_get_entries', [], UrlGeneratorInterface::ABSOLUTE_URL)
|
||||
);
|
||||
|
||||
$json = $this->get('serializer')->serialize($paginatedCollection, 'json');
|
||||
|
@ -234,7 +234,7 @@ class EntryController extends Controller
|
||||
throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type));
|
||||
}
|
||||
|
||||
$form = $this->createForm(new EntryFilterType($repository, $this->getUser()));
|
||||
$form = $this->createForm(EntryFilterType::class);
|
||||
|
||||
if ($request->query->has($form->getName())) {
|
||||
// manually bind values from the request
|
||||
|
@ -12,7 +12,7 @@ use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||
|
||||
class EntryFilterType extends AbstractType
|
||||
{
|
||||
@ -23,12 +23,12 @@ class EntryFilterType extends AbstractType
|
||||
* Repository & user are used to get a list of language entries for this user.
|
||||
*
|
||||
* @param EntityRepository $entryRepository
|
||||
* @param User $user
|
||||
* @param TokenStorage $token
|
||||
*/
|
||||
public function __construct(EntityRepository $entryRepository, User $user)
|
||||
public function __construct(EntityRepository $entryRepository, TokenStorage $token)
|
||||
{
|
||||
$this->repository = $entryRepository;
|
||||
$this->user = $user;
|
||||
$this->user = $token->getToken()->getUser();
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
@ -54,13 +54,13 @@ class EntryFilterType extends AbstractType
|
||||
)
|
||||
->add('domainName', TextFilterType::class, array(
|
||||
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
|
||||
$value = $values['value'];
|
||||
if (strlen($value) <= 2 || empty($value)) {
|
||||
return;
|
||||
}
|
||||
$expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%'));
|
||||
$value = $values['value'];
|
||||
if (strlen($value) <= 2 || empty($value)) {
|
||||
return;
|
||||
}
|
||||
$expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%'));
|
||||
|
||||
return $filterQuery->createCondition($expression);
|
||||
return $filterQuery->createCondition($expression);
|
||||
},
|
||||
))
|
||||
->add('isArchived', CheckboxFilterType::class)
|
||||
|
@ -26,7 +26,7 @@ class UserInformationType extends AbstractType
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return 'fos_user_registration';
|
||||
return 'FOS\UserBundle\Form\Type\RegistrationFormType';
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
|
@ -14,6 +14,14 @@ services:
|
||||
tags:
|
||||
- { name: form.type }
|
||||
|
||||
wallabag_core.filter.type.entry:
|
||||
class: Wallabag\CoreBundle\Filter\EntryFilterType
|
||||
arguments:
|
||||
- "@wallabag_core.entry_repository"
|
||||
- "@security.token_storage"
|
||||
tags:
|
||||
- { name: form.type }
|
||||
|
||||
wallabag_core.param_converter.username_rsstoken_converter:
|
||||
class: Wallabag\CoreBundle\ParamConverter\UsernameRssTokenConverter
|
||||
tags:
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
|
||||
class PocketController extends Controller
|
||||
@ -23,12 +24,12 @@ class PocketController extends Controller
|
||||
public function authAction()
|
||||
{
|
||||
$requestToken = $this->get('wallabag_import.pocket.import')
|
||||
->getRequestToken($this->generateUrl('import', [], true));
|
||||
->getRequestToken($this->generateUrl('import', UrlGeneratorInterface::ABSOLUTE_URL));
|
||||
|
||||
$this->get('session')->set('import.pocket.code', $requestToken);
|
||||
|
||||
return $this->redirect(
|
||||
'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', [], true),
|
||||
'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', UrlGeneratorInterface::ABSOLUTE_URL),
|
||||
301
|
||||
);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class WallabagV1Controller extends Controller
|
||||
*/
|
||||
public function indexAction(Request $request)
|
||||
{
|
||||
$form = $this->createForm(new UploadImportType());
|
||||
$form = $this->createForm(UploadImportType::class);
|
||||
$form->handleRequest($request);
|
||||
|
||||
$wallabag = $this->get('wallabag_import.wallabag_v1.import');
|
||||
|
@ -4,18 +4,20 @@ namespace Wallabag\ImportBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
|
||||
class UploadImportType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('file', 'file')
|
||||
->add('save', 'submit')
|
||||
->add('file', FileType::class)
|
||||
->add('save', SubmitType::class)
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'upload_import_file';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user