diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-01-15 15:38:31 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-01-15 15:38:31 +0100 |
commit | 1930c19d8214c05ceefac5ac011a6b6e7e4a983d (patch) | |
tree | 8f07ffa139c7c2e883a560ef7dbb35a76adfb8dd /src/Wallabag/CoreBundle/Controller | |
parent | 790573d45899504bdecd2573c8f64018e23b139e (diff) | |
parent | 131eaa3e94ace8d75d6218e5c7c3aa58d5bb5009 (diff) | |
download | wallabag-1930c19d8214c05ceefac5ac011a6b6e7e4a983d.tar.gz wallabag-1930c19d8214c05ceefac5ac011a6b6e7e4a983d.tar.zst wallabag-1930c19d8214c05ceefac5ac011a6b6e7e4a983d.zip |
Merge pull request #1524 from wallabag/sf2.8
Upgrade to Symfony 3.0
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 3d22c7bc..aa70307b 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 | ||
@@ -117,7 +117,7 @@ class EntryController extends Controller | |||
117 | { | 117 | { |
118 | $this->checkUserAction($entry); | 118 | $this->checkUserAction($entry); |
119 | 119 | ||
120 | $form = $this->createForm(new EditEntryType(), $entry); | 120 | $form = $this->createForm(EditEntryType::class, $entry); |
121 | 121 | ||
122 | $form->handleRequest($request); | 122 | $form->handleRequest($request); |
123 | 123 | ||
@@ -239,7 +239,7 @@ class EntryController extends Controller | |||
239 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); | 239 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); |
240 | } | 240 | } |
241 | 241 | ||
242 | $form = $this->get('form.factory')->create(new EntryFilterType($repository, $this->getUser())); | 242 | $form = $this->createForm(EntryFilterType::class); |
243 | 243 | ||
244 | if ($request->query->has($form->getName())) { | 244 | if ($request->query->has($form->getName())) { |
245 | // manually bind values from the request | 245 | // 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()) { |