diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
4 files changed, 25 insertions, 24 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 7a187710..d0cf91de 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -4,17 +4,18 @@ namespace Wallabag\CoreBundle\Controller; | |||
4 | 4 | ||
5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | 5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
7 | use Symfony\Component\HttpFoundation\Request; | ||
8 | use Symfony\Component\HttpFoundation\JsonResponse; | 7 | use Symfony\Component\HttpFoundation\JsonResponse; |
8 | use Symfony\Component\HttpFoundation\Request; | ||
9 | use Wallabag\CoreBundle\Entity\Config; | 9 | use Wallabag\CoreBundle\Entity\Config; |
10 | use Wallabag\CoreBundle\Entity\TaggingRule; | 10 | use Wallabag\CoreBundle\Entity\TaggingRule; |
11 | use Wallabag\UserBundle\Entity\User; | 11 | use Wallabag\CoreBundle\Form\Type\ConfigType; |
12 | use Wallabag\CoreBundle\Form\Type\ChangePasswordType; | 12 | use Wallabag\CoreBundle\Form\Type\ChangePasswordType; |
13 | use Wallabag\CoreBundle\Form\Type\UserInformationType; | ||
14 | use Wallabag\CoreBundle\Form\Type\TaggingRuleType; | ||
15 | use Wallabag\CoreBundle\Form\Type\NewUserType; | 13 | use Wallabag\CoreBundle\Form\Type\NewUserType; |
16 | use Wallabag\CoreBundle\Form\Type\RssType; | 14 | use Wallabag\CoreBundle\Form\Type\RssType; |
15 | use Wallabag\CoreBundle\Form\Type\TaggingRuleType; | ||
16 | use Wallabag\CoreBundle\Form\Type\UserInformationType; | ||
17 | use Wallabag\CoreBundle\Tools\Utils; | 17 | use Wallabag\CoreBundle\Tools\Utils; |
18 | use Wallabag\UserBundle\Entity\User; | ||
18 | 19 | ||
19 | class ConfigController extends Controller | 20 | class ConfigController extends Controller |
20 | { | 21 | { |
@@ -31,7 +32,7 @@ class ConfigController extends Controller | |||
31 | $user = $this->getUser(); | 32 | $user = $this->getUser(); |
32 | 33 | ||
33 | // handle basic config detail (this form is defined as a service) | 34 | // handle basic config detail (this form is defined as a service) |
34 | $configForm = $this->createForm('config', $config, array('action' => $this->generateUrl('config'))); | 35 | $configForm = $this->createForm(ConfigType::class, $config, array('action' => $this->generateUrl('config'))); |
35 | $configForm->handleRequest($request); | 36 | $configForm->handleRequest($request); |
36 | 37 | ||
37 | if ($configForm->isValid()) { | 38 | if ($configForm->isValid()) { |
@@ -51,7 +52,7 @@ class ConfigController extends Controller | |||
51 | } | 52 | } |
52 | 53 | ||
53 | // handle changing password | 54 | // handle changing password |
54 | $pwdForm = $this->createForm(new ChangePasswordType(), null, array('action' => $this->generateUrl('config').'#set4')); | 55 | $pwdForm = $this->createForm(ChangePasswordType::class, null, array('action' => $this->generateUrl('config').'#set4')); |
55 | $pwdForm->handleRequest($request); | 56 | $pwdForm->handleRequest($request); |
56 | 57 | ||
57 | if ($pwdForm->isValid()) { | 58 | if ($pwdForm->isValid()) { |
@@ -67,7 +68,7 @@ class ConfigController extends Controller | |||
67 | } | 68 | } |
68 | 69 | ||
69 | // handle changing user information | 70 | // handle changing user information |
70 | $userForm = $this->createForm(new UserInformationType(), $user, array( | 71 | $userForm = $this->createForm(UserInformationType::class, $user, array( |
71 | 'validation_groups' => array('Profile'), | 72 | 'validation_groups' => array('Profile'), |
72 | 'action' => $this->generateUrl('config').'#set3', | 73 | 'action' => $this->generateUrl('config').'#set3', |
73 | )); | 74 | )); |
@@ -85,7 +86,7 @@ class ConfigController extends Controller | |||
85 | } | 86 | } |
86 | 87 | ||
87 | // handle rss information | 88 | // handle rss information |
88 | $rssForm = $this->createForm(new RssType(), $config, array('action' => $this->generateUrl('config').'#set2')); | 89 | $rssForm = $this->createForm(RssType::class, $config, array('action' => $this->generateUrl('config').'#set2')); |
89 | $rssForm->handleRequest($request); | 90 | $rssForm->handleRequest($request); |
90 | 91 | ||
91 | if ($rssForm->isValid()) { | 92 | if ($rssForm->isValid()) { |
@@ -102,7 +103,7 @@ class ConfigController extends Controller | |||
102 | 103 | ||
103 | // handle tagging rule | 104 | // handle tagging rule |
104 | $taggingRule = new TaggingRule(); | 105 | $taggingRule = new TaggingRule(); |
105 | $newTaggingRule = $this->createForm(new TaggingRuleType(), $taggingRule, array('action' => $this->generateUrl('config').'#set5')); | 106 | $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, array('action' => $this->generateUrl('config').'#set5')); |
106 | $newTaggingRule->handleRequest($request); | 107 | $newTaggingRule->handleRequest($request); |
107 | 108 | ||
108 | if ($newTaggingRule->isValid()) { | 109 | if ($newTaggingRule->isValid()) { |
@@ -122,7 +123,7 @@ class ConfigController extends Controller | |||
122 | $newUser = $userManager->createUser(); | 123 | $newUser = $userManager->createUser(); |
123 | // enable created user by default | 124 | // enable created user by default |
124 | $newUser->setEnabled(true); | 125 | $newUser->setEnabled(true); |
125 | $newUserForm = $this->createForm(new NewUserType(), $newUser, array( | 126 | $newUserForm = $this->createForm(NewUserType::class, $newUser, array( |
126 | 'validation_groups' => array('Profile'), | 127 | 'validation_groups' => array('Profile'), |
127 | 'action' => $this->generateUrl('config').'#set5', | 128 | 'action' => $this->generateUrl('config').'#set5', |
128 | )); | 129 | )); |
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 1949bdf8..9dd904f1 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -2,16 +2,16 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Controller; | 3 | namespace Wallabag\CoreBundle\Controller; |
4 | 4 | ||
5 | use Pagerfanta\Adapter\DoctrineORMAdapter; | ||
6 | use Pagerfanta\Pagerfanta; | ||
5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 8 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
7 | use Symfony\Component\HttpFoundation\Request; | 9 | use Symfony\Component\HttpFoundation\Request; |
8 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | 10 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
9 | use Wallabag\CoreBundle\Entity\Entry; | 11 | use Wallabag\CoreBundle\Entity\Entry; |
10 | use Wallabag\CoreBundle\Form\Type\NewEntryType; | ||
11 | use Wallabag\CoreBundle\Form\Type\EditEntryType; | ||
12 | use Wallabag\CoreBundle\Filter\EntryFilterType; | 12 | use Wallabag\CoreBundle\Filter\EntryFilterType; |
13 | use Pagerfanta\Adapter\DoctrineORMAdapter; | 13 | use Wallabag\CoreBundle\Form\Type\EditEntryType; |
14 | use Pagerfanta\Pagerfanta; | 14 | use Wallabag\CoreBundle\Form\Type\NewEntryType; |
15 | 15 | ||
16 | class EntryController extends Controller | 16 | class EntryController extends Controller |
17 | { | 17 | { |
@@ -43,7 +43,7 @@ class EntryController extends Controller | |||
43 | { | 43 | { |
44 | $entry = new Entry($this->getUser()); | 44 | $entry = new Entry($this->getUser()); |
45 | 45 | ||
46 | $form = $this->createForm(new NewEntryType(), $entry); | 46 | $form = $this->createForm(NewEntryType::class, $entry); |
47 | 47 | ||
48 | $form->handleRequest($request); | 48 | $form->handleRequest($request); |
49 | 49 | ||
@@ -116,7 +116,7 @@ class EntryController extends Controller | |||
116 | { | 116 | { |
117 | $this->checkUserAction($entry); | 117 | $this->checkUserAction($entry); |
118 | 118 | ||
119 | $form = $this->createForm(new EditEntryType(), $entry); | 119 | $form = $this->createForm(EditEntryType::class, $entry); |
120 | 120 | ||
121 | $form->handleRequest($request); | 121 | $form->handleRequest($request); |
122 | 122 | ||
@@ -238,7 +238,7 @@ class EntryController extends Controller | |||
238 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); | 238 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); |
239 | } | 239 | } |
240 | 240 | ||
241 | $form = $this->get('form.factory')->create(new EntryFilterType($repository, $this->getUser())); | 241 | $form = $this->createForm(EntryFilterType::class); |
242 | 242 | ||
243 | if ($request->query->has($form->getName())) { | 243 | if ($request->query->has($form->getName())) { |
244 | // manually bind values from the request | 244 | // manually bind values from the request |
diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php index 023a6228..2b7ef598 100644 --- a/src/Wallabag/CoreBundle/Controller/RssController.php +++ b/src/Wallabag/CoreBundle/Controller/RssController.php | |||
@@ -2,13 +2,13 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Controller; | 3 | namespace Wallabag\CoreBundle\Controller; |
4 | 4 | ||
5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | 5 | use Pagerfanta\Adapter\DoctrineORMAdapter; |
6 | use Pagerfanta\Pagerfanta; | ||
6 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; |
8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | ||
7 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 9 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
8 | use Wallabag\UserBundle\Entity\User; | ||
9 | use Wallabag\CoreBundle\Entity\Entry; | 10 | use Wallabag\CoreBundle\Entity\Entry; |
10 | use Pagerfanta\Adapter\DoctrineORMAdapter; | 11 | use Wallabag\UserBundle\Entity\User; |
11 | use Pagerfanta\Pagerfanta; | ||
12 | 12 | ||
13 | class RssController extends Controller | 13 | class RssController extends Controller |
14 | { | 14 | { |
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 64d53f0c..ff4d64a8 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php | |||
@@ -5,9 +5,9 @@ namespace Wallabag\CoreBundle\Controller; | |||
5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | 5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
7 | use Symfony\Component\HttpFoundation\Request; | 7 | use Symfony\Component\HttpFoundation\Request; |
8 | use Wallabag\CoreBundle\Form\Type\NewTagType; | ||
9 | use Wallabag\CoreBundle\Entity\Tag; | ||
10 | use Wallabag\CoreBundle\Entity\Entry; | 8 | use Wallabag\CoreBundle\Entity\Entry; |
9 | use Wallabag\CoreBundle\Entity\Tag; | ||
10 | use Wallabag\CoreBundle\Form\Type\NewTagType; | ||
11 | 11 | ||
12 | class TagController extends Controller | 12 | class TagController extends Controller |
13 | { | 13 | { |
@@ -21,7 +21,7 @@ class TagController extends Controller | |||
21 | public function addTagFormAction(Request $request, Entry $entry) | 21 | public function addTagFormAction(Request $request, Entry $entry) |
22 | { | 22 | { |
23 | $tag = new Tag(); | 23 | $tag = new Tag(); |
24 | $form = $this->createForm(new NewTagType(), $tag); | 24 | $form = $this->createForm(NewTagType::class, $tag); |
25 | $form->handleRequest($request); | 25 | $form->handleRequest($request); |
26 | 26 | ||
27 | if ($form->isValid()) { | 27 | if ($form->isValid()) { |