Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit76ffdd7

Browse files
committed
Merge branch '3.4'
* 3.4: Update custom_constraint.rst [#8087] fix merge Updated language for annouce event Update form best practises regarding Form::isValid Add form_theme in error customization [Routing] is usable without SensioFrameworkBundle since 3.4 Fix typo er(r)or Update questionhelper.rst Typo: lowercase letter Wrap the instantiation in parenthesis, and chain away fix variable being overwritten
2 parentsb2d8234 +03f46c1 commit76ffdd7

File tree

35 files changed

+80
-74
lines changed

35 files changed

+80
-74
lines changed

‎best_practices/controllers.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ for the homepage of our app:
9696
namespace AppBundle\Controller;
9797
9898
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
99-
useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;
99+
useSymfony\Component\Routing\Annotation\Route;
100100
101101
class DefaultController extends Controller
102102
{
@@ -149,7 +149,7 @@ For example:
149149
..code-block::php
150150
151151
use AppBundle\Entity\Post;
152-
useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;
152+
useSymfony\Component\Routing\Annotation\Route;
153153
154154
/**
155155
* @Route("/{id}", name="admin_post_show")
@@ -202,9 +202,9 @@ flexible:
202202
..code-block::php
203203
204204
use AppBundle\Entity\Post;
205-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
206205
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
207206
use Symfony\Component\HttpFoundation\Request;
207+
use Symfony\Component\Routing\Annotation\Route;
208208
209209
/**
210210
* @Route("/comment/{postSlug}/new", name = "comment_new")

‎best_practices/forms.rst‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ and a ``createAction()`` that *only* processes the form submit. Both those
204204
actions will be almost identical. So it's much simpler to let ``newAction()``
205205
handle everything.
206206

207-
Second, we recommend using ``$form->isSubmitted()`` in the ``if`` statement
208-
for clarity. This isn't technically needed, since ``isValid()`` first calls
209-
``isSubmitted()``. But without this, the flow doesn't read well as it *looks*
210-
like the form is *always* processed (even on the GET request).
207+
Second, is it required to call ``$form->isSubmitted()`` in the ``if`` statement
208+
before calling ``isValid()``. Calling ``isValid()`` with an unsubmitted form
209+
is deprecated since version 3.2 and will throw an exception in 4.0.

‎best_practices/security.rst‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ Using ``@Security``, this looks like:
109109

110110
..code-block::php
111111
112-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
113112
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
113+
use Symfony\Component\Routing\Annotation\Route;
114114
// ...
115115
116116
/**
@@ -135,8 +135,8 @@ method on the ``Post`` object:
135135
..code-block::php
136136
137137
use AppBundle\Entity\Post;
138-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
139138
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
139+
use Symfony\Component\Routing\Annotation\Route;
140140
141141
/**
142142
* @Route("/{id}/edit", name="admin_post_edit")
@@ -191,6 +191,7 @@ Now you can reuse this method both in the template and in the security expressio
191191
192192
use AppBundle\Entity\Post;
193193
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
194+
use Symfony\Component\Routing\Annotation\Route;
194195
195196
/**
196197
* @Route("/{id}/edit", name="admin_post_edit")

‎components/console/helpers/questionhelper.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,15 @@ convenient for passwords::
212212
On Windows systems, this ``stty`` command may generate gibberish output and
213213
mangle the input text. If that's your case, disable it with this command::
214214

215+
use Symfony\Component\Console\Helper\QuestionHelper;
215216
use Symfony\Component\Console\Question\ChoiceQuestion;
216217

217218
// ...
218219
public function execute(InputInterface $input, OutputInterface $output)
219220
{
220221
// ...
221222
$helper = $this->getHelper('question');
222-
$helper->disableStty();
223+
QuestionHelper::disableStty();
223224

224225
// ...
225226
}

‎components/routing.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ routes with UTF-8 characters:
368368
namespace AppBundle\Controller;
369369
370370
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
371-
useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;
371+
useSymfony\Component\Routing\Annotation\Route;
372372
373373
class DefaultController extends Controller
374374
{
@@ -442,7 +442,7 @@ You can also include UTF-8 strings as routing requirements:
442442
namespace AppBundle\Controller;
443443
444444
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
445-
useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;
445+
useSymfony\Component\Routing\Annotation\Route;
446446
447447
class DefaultController extends Controller
448448
{
@@ -508,7 +508,7 @@ You can also include UTF-8 strings as routing requirements:
508508
// ...
509509
510510
return $collection;
511-
511+
512512
..tip::
513513

514514
In addition to UTF-8 characters, the Routing component also supports all

‎configuration/micro_kernel_trait.rst‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,9 @@ your ``composer.json`` file to load from there:
127127
}
128128
}
129129
130-
Now, suppose you want to use Twig and load routes via annotations. For annotation
131-
routing, you need SensioFrameworkExtraBundle. This comes with a normal Symfony project.
132-
But in this case, you need to download it:
133-
134-
..code-block::bash
135-
136-
$ composer require sensio/framework-extra-bundle
137-
138-
Instead of putting *everything* in ``index.php``, create a new ``app/AppKernel.php``
139-
to hold the kernel. Now it looks like this::
130+
Now, suppose you want to use Twig and load routes via annotations. Instead of
131+
putting *everything* in ``index.php``, create a new ``app/AppKernel.php`` to
132+
hold the kernel. Now it looks like this::
140133

141134
// app/AppKernel.php
142135

@@ -161,7 +154,6 @@ to hold the kernel. Now it looks like this::
161154
$bundles = array(
162155
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
163156
new Symfony\Bundle\TwigBundle\TwigBundle(),
164-
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle()
165157
);
166158

167159
if ($this->getEnvironment() == 'dev') {
@@ -209,6 +201,12 @@ to hold the kernel. Now it looks like this::
209201
}
210202
}
211203

204+
205+
..versionadded::3.4
206+
Support for annotation routing without an external bundle was added in
207+
Symfony 3.4. Prior to version 3.4, you needed to install the
208+
SensioFrameworkExtraBundle.
209+
212210
Unlike the previous kernel, this loads an external ``app/config/config.yml`` file,
213211
because the configuration started to get bigger:
214212

@@ -261,7 +259,7 @@ has one file in it::
261259
namespace App\Controller;
262260

263261
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
264-
useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;
262+
useSymfony\Component\Routing\Annotation\Route;
265263

266264
class MicroController extends Controller
267265
{

‎controller.rst‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ This renders a page that prints a lucky (random) number::
1616
// src/AppBundle/Controller/LuckyController.php
1717
namespace AppBundle\Controller;
1818

19-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
2019
use Symfony\Component\HttpFoundation\Response;
20+
use Symfony\Component\Routing\Annotation\Route;
2121

2222
class LuckyController
2323
{
@@ -59,7 +59,7 @@ class::
5959
namespace AppBundle\Controller;
6060

6161
use Symfony\Component\HttpFoundation\Response;
62-
useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;
62+
useSymfony\Component\Routing\Annotation\Route;
6363

6464
class LuckyController
6565
{
@@ -325,7 +325,7 @@ controller's service config:
325325
326326
// app/config/services.php
327327
use AppBundle\Controller\LuckyController;
328-
328+
329329
$container->register(LuckyController::class)
330330
->setPublic(true)
331331
->addTag('controller.service_arguments', [
@@ -372,7 +372,7 @@ method. Here are several common services you might need::
372372
// you can also fetch parameters
373373
$someParameter = $this->getParameter('some_parameter');
374374

375-
If you receive aneror like:
375+
If you receive anerror like:
376376

377377
..code-block::text
378378

‎controller/service.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ syntax:
3434
..code-block::php-annotations
3535
3636
# src/AppBundle/Controller/HelloController.php
37+
38+
// You need to use Sensio's annotation to specify a service id
39+
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
3740
// ...
3841
3942
/**

‎controller/soap_web_service.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ can be retrieved via ``/soap?wsdl``::
6161

6262
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6363
use Symfony\Component\HttpFoundation\Response;
64-
useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;
64+
useSymfony\Component\Routing\Annotation\Route;
6565
use AppBundle\Service\HelloService;
6666

6767
class HelloServiceController extends Controller

‎controller/upload_file.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ Finally, you need to update the code of the controller that handles the form::
110110
// src/AppBundle/Controller/ProductController.php
111111
namespace AppBundle\ProductController;
112112

113-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
114113
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
115114
use Symfony\Component\HttpFoundation\Request;
115+
use Symfony\Component\Routing\Annotation\Route;
116116
use AppBundle\Entity\Product;
117117
use AppBundle\Form\ProductType;
118118

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp