8000 Merge branch '4.0' · symfony/symfony-docs@7c2ff24 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7c2ff24

Browse files
committed
Merge branch '4.0'
* 4.0: doc(http_foundation.rst): Fix code error which used create() instead of constructor method. [#8806] minor reword Minor changes Update article block from pull request feedback. Forgot a apostrophe. Improvements on the apache section. Added the Flex node for Apache. add back the trailing comma remove "choices_as_values" mention Fixed configuration block rendering in routing docs Update entity.rst Removing more AppBundle Follow the same code style in docblock annotations
2 parents bb82909 + 48c1dca commit 7c2ff24

26 files changed

+102
-54
lines changed

best_practices/business-logic.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ looking for mapping information:
206206
* mappedBy="post",
207207
* orphanRemoval=true
208208
* )
209-
* @ORM\OrderBy({"publishedAt" = "ASC"})
209+
* @ORM\OrderBy({"publishedAt"="ASC"})
210210
*/
211211
private $comments;
212212

best_practices/controllers.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ the entity manually. In our application, we have this situation in
192192
.. code-block:: php
193193
194194
/**
195-
* @Route("/comment/{postSlug}/new", name = "comment_new")
195+
* @Route("/comment/{postSlug}/new", name="comment_new")
196196
*/
197197
public function new(Request $request, $postSlug)
198198
{
@@ -218,8 +218,8 @@ flexible:
218218
use Symfony\Component\Routing\Annotation\Route;
219219
220220
/**
221-
* @Route("/comment/{postSlug}/new", name = "comment_new")
222-
* @ParamConverter("post", options={"mapping": {"postSlug": "slug"}})
221+
* @Route("/comment/{postSlug}/new", name="comment_new")
222+
* @ParamConverter("post", options={"mapping"={"postSlug"="slug"}})
223223
*/
224224
public function new(Request $request, Post $post)
225225
{

bundles/best_practices.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,15 +454,15 @@ Resources
454454

455455
If the bundle references any resources (config files, translation files, etc.),
456456
don't use physical paths (e.g. ``__DIR__/config/services.xml``) but logical
457-
paths (e.g. ``@AppBundle/Resources/config/services.xml``).
457+
paths (e.g. ``@FooBundle/Resources/config/services.xml``).
458458

459459
The logical paths are required because of the bundle overriding mechanism that
460460
lets you override any resource/file of any bundle. See :ref:`http-kernel-resource-locator`
461461
for more details about transforming physical paths into logical paths.
462462

463463
Beware that templates use a simplified version of the logical path shown above.
464464
For example, an ``index.html.twig`` template located in the ``Resources/views/Default/``
465-
directory of the AppBundle, is referenced as ``@App/Default/index.html.twig``.
465+
directory of the FooBundle, is referenced as ``@Foo/Default/index.html.twig``.
466466

467467
Learn more
468468
----------

bundles/override.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ features of a bundle.
1212

1313
The bundle overriding mechanism means that you cannot use physical paths to
1414
refer to bundle's resources (e.g. ``__DIR__/config/services.xml``). Always
15-
use logical paths in your bundles (e.g. ``@AppBundle/Resources/config/services.xml``)
15+
use logical paths in your bundles (e.g. ``@FooBundle/Resources/config/services.xml``)
1616
and call the :ref:`locateResource() method <http-kernel-resource-locator>`
1717
to turn them into physical paths when needed.
1818

components/console/helpers/questionhelper.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ method::
247247
// ...
248248
$helper = $this->getHelper('question');
249249

250-
$question = new Question('Please enter the name of the bundle', 'AppBundle');
250+
$question = new Question('Please enter the name of the bundle', 'AcmeDemoBundle');
251251
$question->setNormalizer(function ($value) {
252252
// $value can be null here
253253
return $value ? trim($value) : '';

components/http_foundation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ PHP callable that is able to create an instance of your ``Request`` class::
297297
array $server = array(),
298298
$content = null
299299
) {
300-
return SpecialRequest::create(
300+
return new SpecialRequest(
301301
$query,
302302
$request,
303303
$attributes,

components/http_kernel.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ on the request's information.
258258

259259
a) If the ``_controller`` key doesn't follow the recommended PHP namespace
260260
format (e.g. ``App\Controller\DefaultController::index``) its format is
261-
transformed into it. For example, the legacy ``AppBundle:Default:index``
262-
format would be changed to ``Acme\AppBundle\Controller\DefaultController::indexAction``.
261+
transformed into it. For example, the legacy ``FooBundle:Default:index``
262+
format would be changed to ``Acme\FooBundle\Controller\DefaultController::indexAction``.
263263
This transformation is specific to the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver`
264264
sub-class used by the Symfony Framework.
265265

@@ -742,10 +742,10 @@ translation files, etc.)
742742

743743
This overriding mechanism works because resources are referenced not by their
744744
physical path but by their logical path. For example, the ``services.xml`` file
745-
stored in the ``Resources/config/`` directory of a bundle called AppBundle is
746-
referenced as ``@AppBundle/Resources/config/services.xml``. This logical path
745+
stored in the ``Resources/config/`` directory of a bundle called FooBundle is
746+
referenced as ``@FooBundle/Resources/config/services.xml``. This logical path
747747
will work when the application overrides that file and even if you change the
748-
directory of AppBundle.
748+
directory of FooBundle.
749749

750750
The HttpKernel component provides a method called :method:`Symfony\\Component\\HttpKernel\\Kernel::locateResource`
751751
which can be used to transform logical paths into physical paths::
@@ -754,7 +754,7 @@ which can be used to transform logical paths into physical paths::
754754

755755
// ...
756756
$kernel = new HttpKernel($dispatcher, $resolver);
757-
$path = $kernel->locateResource('@AppBundle/Resources/config/services.xml');
757+
$path = $kernel->locateResource('@FooBundle/Resources/config/services.xml');
758758

759759
Learn more
760760
----------

contributing/documentation/standards.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ Code Examples
5454
* The code examples should look real for a web application context. Avoid abstract
5555
or trivial examples (``foo``, ``bar``, ``demo``, etc.);
5656
* The code should follow the :doc:`Symfony Best Practices </best_practices/introduction>`.
57-
Unless the example requires a custom bundle, make sure to always use the
58-
``AppBundle`` bundle to store your code;
5957
* Use ``Acme`` when the code requires a vendor name;
6058
* Use ``example.com`` as the domain of sample URLs and ``example.org`` and
6159
``example.net`` when additional domains are required. All of these domains are

doctrine/multiple_entity_managers.rst

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,21 @@ The following configuration code shows how you can configure two entity managers
5050
default:
5151
connection: default
5252
mappings:
53-
AppBundle: ~
54-
AcmeStoreBundle: ~
53+
Main:
54+
is_bundle: false
55+
type: annotation
56+
dir: '%kernel.project_dir%/src/Entity/Main'
57+
prefix: 'App\Entity\Main'
58+
alias: Main
5559
customer:
5660
connection: customer
5761
mappings:
58-
AcmeCustomerBundle: ~
62+
Customer:
63+
is_bundle: false
64+
type: annotation
65+
dir: '%kernel.project_dir%/src/Entity/Customer'
66+
prefix: 'App\Entity\Customer'
67+
alias: Customer
5968
6069
.. code-block:: xml
6170
@@ -94,12 +103,25 @@ The following configuration code shows how you can configure two entity managers
94103
95104
<doctrine:orm default-entity-manager="default">
96105
<doctrine:entity-manager name="default" connection="default">
97-
<doctrine:mapping name="AppBundle" />
98-
<doctrine:mapping name="AcmeStoreBundle" />
106+
<doctrine:mapping
107+
name="Main"
108+
is_bundle="false"
109+
type="annotation"
110+
dir="%kernel.project_dir%/src/Entity/Main"
111+
prefix="App\Entity\Main"
112+
alias="Main"
113+
/>
99114
</doctrine:entity-manager>
100115
101116
<doctrine:entity-manager name="customer" connection="customer">
102-
<doctrine:mapping name="AcmeCustomerBundle" />
117+
<doctrine:mapping
118+
name="Customer"
119+
is_bundle="false"
120+
type="annotation"
121+
dir="%kernel.project_dir%/src/Entity/Customer"
122+
prefix="App\Entity\Customer"
123+
alias="Customer"
124+
/>
103125
</doctrine:entity-manager>
104126
</doctrine:orm>
105127
</doctrine:config>
@@ -139,14 +161,25 @@ The following configuration code shows how you can configure two entity managers
139161
'default' => array(
140162
'connection' => 'default',
141163
'mappings' => array(
142-
'AppBundle' => null,
143-
'AcmeStoreBundle' => null,
164+
'Main' => array(
165+
is_bundle => false,
166+
type => 'annotation',
167+
dir => '%kernel.project_dir%/src/Entity/Main',
168+
prefix => 'App\Entity\Main',
169+
alias => 'Main',
170+
)
144171
),
145172
),
146173
'customer' => array(
147174
'connection' => 'customer',
148175
'mappings' => array(
149-
'AcmeCustomerBundle' => null,
176+
'Customer' => array(
177+
is_bundle => false,
178+
type => 'annotation',
179+
dir => '%kernel.project_dir%/src/Entity/Customer',
180+
prefix => 'App\Entity\Customer',
181+
alias => 'Customer',
182+
)
150183
),
151184
),
152185
),
@@ -155,8 +188,8 @@ The following configuration code shows how you can configure two entity managers
155188
156189
In this case, you've defined two entity managers and called them ``default``
157190
and ``customer``. The ``default`` entity manager manages entities in the
158-
AppBundle and AcmeStoreBundle, while the ``customer`` entity manager manages
159-
entities in the AcmeCustomerBundle. You've also defined two connections, one
191+
``src/Entity/Main`` directory, while the ``customer`` entity manager manages
192+
entities in ``src/Entity/Customer``. You've also defined two connections, one
160193
for each entity manager.
161194

162195
.. note::

form/create_custom_field_type.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ for form fields, which is ``<BundleName>\Form\Type``. Make sure the field extend
3636
'Expedited Shipping' => 'expedited',
3737
'Priority Shipping' => 'priority',
3838
),
39-
'choices_as_values' => true,
4039
));
4140
}
4241

reference/constraints/All.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ entry in that array:
3535
/**
3636
* @Assert\All({
3737
* @Assert\NotBlank,
38-
* @Assert\Length(min = 5)
38+
* @Assert\Length(min=5)
3939
* })
4040
*/
4141
protected $favoriteColors = array();

reference/constraints/Choice.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ If your valid choice list is simple, you can pass them in directly via the
5252
protected $city;
5353
5454
/**
55-
* @Assert\Choice(choices = {"fiction", "non-fiction"}, message = "Choose a valid genre.")
55+
* @Assert\Choice(choices={"fiction", "non-fiction"}, message="Choose a valid genre.")
5656
*/
5757
protected $genre;
5858
}
@@ -159,7 +159,7 @@ constraint.
159159
class Author
160160
{
161161
/**
162-
* @Assert\Choice(callback = "getGenres")
162+
* @Assert\Choice(callback="getGenres")
163163
*/
164164
protected $genre;
165165
}
@@ -224,7 +224,7 @@ you can pass the class name and the method as an array.
224224
class Author
225225
{
226226
/**
227-
* @Assert\Choice(callback = {"Util", "getGenres"})
227+
* @Assert\Choice(callback={"Util", "getGenres"})
228228
*/
229229
protected $genre;
230230
}

reference/constraints/IsTrue.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Then you can constrain this method with ``IsTrue``.
5555
protected $token;
5656
5757
/**
58-
* @Assert\IsTrue(message = "The token is invalid")
58+
* @Assert\IsTrue(message="The token is invalid")
5959
*/
6060
public function isTokenValid()
6161
{

reference/constraints/Luhn.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ will contain a credit card number.
3434
class Transaction
3535
{
3636
/**
37-
* @Assert\Luhn(message = "Please check your credit card number.")
37+
* @Assert\Luhn(message="Please check your credit card number.")
3838
*/
3939
protected $cardNumber;
4040
}

reference/constraints/Valid.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ stores an ``Address`` instance in the ``$address`` property.
6464
6565
/**
6666
* @Assert\NotBlank
67-
* @Assert\Length(max = 5)
67+
* @Assert\Length(max=5)
6868
*/
6969
protected $zipCode;
7070
}
@@ -78,7 +78,7 @@ stores an ``Address`` instance in the ``$address`` property.
7878
{
7979
/**
8080
* @Assert\NotBlank
81-
* @Assert\Length(min = 4)
81+
* @Assert\Length(min=4)
8282
*/
8383
protected $firstName;
8484

reference/forms/types/entity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ be listed inside the choice field::
6363

6464
$builder->add('users', EntityType::class, array(
6565
// query choices from this entity
66-
'class' => User:class,
66+
'class' => User::class,
6767

6868
// use the User.username property as the visible option string
6969
'choice_label' => 'username',

routing.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Creating Routes
2222

2323
A *route* is a map from a URL path to a controller. Suppose you want one route that
2424
matches ``/blog`` exactly and another more dynamic route that can match *any* URL
25-
like ``/blog/my-post`` or ``/blog/all-about-symfony``::
25+
like ``/blog/my-post`` or ``/blog/all-about-symfony``:
2626

2727
.. configuration-block::
2828

@@ -161,7 +161,7 @@ To fix this, add a *requirement* that the ``{page}`` wildcard can *only* match n
161161
class BlogController extends Controller
162162
{
163163
/**
164-
* @Route("/blog/{page}", name="blog_list", requirements={"page": "\d+"})
164+
* @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})
165165
*/
166166
public function list($page)
167167
{
@@ -260,7 +260,7 @@ So how can you make ``blog_list`` once again match when the user visits
260260
class BlogController extends Controller
261261
{
262262
/**
263-
* @Route("/blog/{page}", name="blog_list", requirements={"page": "\d+"})
263+
* @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})
264264
*/
265265
public function list($page = 1)
266266
{

routing/optional_placeholders.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ This is done by including it in the ``defaults`` collection:
135135
// ...
136136
137137
/**
138-
* @Route("/blog/{page}", defaults={"page" = 1})
138+
* @Route("/blog/{page}", defaults={"page"=1})
139139
*/
140140
public function index($page)
141141
{

routing/requirements.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ a routing ``{wildcard}`` to only match some regular expression:
2121
class BlogController extends Controller
2222
{
2323
/**
24-
* @Route("/blog/{page}", name="blog_list", requirements={"page": "\d+"})
24+
* @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})
2525
*/
2626
public function list($page)
2727
{
@@ -97,8 +97,8 @@ URL:
9797
class MainController extends Controller
9898
{
9999
/**
100-
* @Route("/{_locale}", defaults={"_locale": "en"}, requirements={
101-
* "_locale": "en|fr"
100+
* @Route("/{_locale}", defaults={"_locale"="en"}, requirements={
101+
* "_locale"="en|fr"
102102
* })
103103
*/
104104
public function homepage($_locale)

security/entity_provider.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Before you begin, first make sure you install the Security component:
4242
4343
$ composer require security
4444
45-
For this entry, suppose that you already have a ``User`` entity inside an
46-
``AppBundle`` with the following fields: ``id``, ``username``, ``password``,
45+
For this entry, suppose that you already have a ``User`` entity
46+
with the following fields: ``id``, ``username``, ``password``,
4747
``email`` and ``isActive``::
4848

4949
// src/Entity/User.php

service_container/tags.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ application handlers.
479479
.. code-block:: php
480480
481481
// src/HandlerCollection.php
482-
namespace AppBundle;
482+
namespace App;
483483
484484
class HandlerCollection
485485
{

0 commit comments

Comments
 (0)
0