Skip to content

Commit 8f34feb

Browse files
committed
Merge remote-tracking branch 'upstream/3.3' into 3.3
2 parents 91538f2 + 663f818 commit 8f34feb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+272
-233
lines changed

best_practices/business-logic.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ looking for mapping information:
283283
* mappedBy="post",
284284
* orphanRemoval=true
285285
* )
286-
* @ORM\OrderBy({"publishedAt" = "ASC"})
286+
* @ORM\OrderBy({"publishedAt"="ASC"})
287287
*/
288288
private $comments;
289289
@@ -359,6 +359,10 @@ were defined by the PHP community. You can learn more about
359359
use the `PHP-CS-Fixer`_, which is a command-line utility that can fix the
360360
coding standards of an entire codebase in a matter of seconds.
361361

362+
----
363+
364+
Next: :doc:`/best_practices/controllers`
365+
362366
.. _`full definition`: https://en.wikipedia.org/wiki/Business_logic
363367
.. _`Doctrine project`: http://www.doctrine-project.org/
364368
.. _`fixture class`: https://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html#writing-simple-fixtures

best_practices/configuration.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,5 +215,9 @@ through environment variables:
215215
was added in Symfony 3.2. Prior to version 3.2, you needed to use the
216216
:doc:`special SYMFONY__ variables </configuration/external_parameters>`.
217217

218+
----
219+
220+
Next: :doc:`/best_practices/business-logic`
221+
218222
.. _`feature toggles`: https://en.wikipedia.org/wiki/Feature_toggle
219223
.. _`constant() function`: http://twig.sensiolabs.org/doc/functions/constant.html

best_practices/controllers.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ manually. In our application, we have this situation in ``CommentController``:
182182
.. code-block:: php
183183
184184
/**
185-
* @Route("/comment/{postSlug}/new", name = "comment_new")
185+
* @Route("/comment/{postSlug}/new", name="comment_new")
186186
*/
187187
public function newAction(Request $request, $postSlug)
188188
{
@@ -208,8 +208,8 @@ flexible:
208208
use Symfony\Component\HttpFoundation\Request;
209209
210210
/**
211-
* @Route("/comment/{postSlug}/new", name = "comment_new")
212-
* @ParamConverter("post", options={"mapping": {"postSlug": "slug"}})
211+
* @Route("/comment/{postSlug}/new", name="comment_new")
212+
* @ParamConverter("post", options={"mapping"={"postSlug"="slug"}})
213213
*/
214214
public function newAction(Request $request, Post $post)
215215
{
@@ -227,4 +227,8 @@ If you need to execute some code before or after the execution of your controlle
227227
you can use the EventDispatcher component to
228228
:doc:`set up before and after filters </event_dispatcher/before_after_filters>`.
229229

230+
----
231+
232+
Next: :doc:`/best_practices/templates`
233+
230234
.. _`ParamConverter`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html

best_practices/creating-the-project.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ structure of Symfony, you can
168168
:doc:`override the location of the main directories </configuration/override_dir_structure>`:
169169
``cache/``, ``logs/`` and ``web/``.
170170

171+
----
172+
173+
Next: :doc:`/best_practices/configuration`
174+
171175
.. _`Composer`: https://getcomposer.org/
172176
.. _`Phar extension`: http://php.net/manual/en/intro.phar.php
173177
.. _`public checksums repository`: https://github.com/sensiolabs/checksums

best_practices/forms.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,7 @@ handle everything.
207207
Second, is it required to call ``$form->isSubmitted()`` in the ``if`` statement
208208
before calling ``isValid()``. Calling ``isValid()`` with an unsubmitted form
209209
is deprecated since version 3.2 and will throw an exception in 4.0.
210+
211+
----
212+
213+
Next: :doc:`/best_practices/i18n`

best_practices/i18n.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,8 @@ English in the application would be:
9393
</file>
9494
</xliff>
9595
96+
----
97+
98+
Next: :doc:`/best_practices/security`
99+
96100
.. _`JMSTranslationBundle`: https://github.com/schmittjoh/JMSTranslationBundle

best_practices/introduction.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,9 @@ practices**. The reasons for not doing it are various:
9898
* The amount of work spent on this could be better dedicated to improving
9999
your tests or adding features that provide real value to the end users.
100100

101+
----
102+
103+
Next: :doc:`/best_practices/creating-the-project`
104+
101105
.. _`Fabien Potencier`: https://connect.sensiolabs.com/profile/fabpot
102106
.. _`download and install`: https://symfony.com/download

best_practices/security.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,10 @@ If your company uses a user login method not supported by Symfony, you can
389389
develop :doc:`your own user provider </security/custom_provider>` and
390390
:doc:`your own authentication provider </security/custom_authentication_provider>`.
391391

392+
----
393+
394+
Next: :doc:`/best_practices/web-assets`
395+
392396
.. _`ParamConverter`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
393397
.. _`@Security annotation`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/security.html
394398
.. _`FOSUserBundle`: https://github.com/FriendsOfSymfony/FOSUserBundle

best_practices/templates.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,9 @@ If you're using the :ref:`default services.yml configuration <service-container-
150150
you're done! Symfony will automatically know about your new service and tag it to
151151
be used as a Twig extension.
152152

153+
----
154+
155+
Next: :doc:`/best_practices/forms`
156+
153157
.. _`Twig`: http://twig.sensiolabs.org/
154158
.. _`Parsedown`: http://parsedown.org/

best_practices/web-assets.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,8 @@ with Assetic to reduce their size before serving them to the user. Check out
9595
the `official Assetic documentation`_ to learn more about all the available
9696
features.
9797

98+
----
99+
100+
Next: :doc:`/best_practices/tests`
101+
98102
.. _`official Assetic documentation`: https://github.com/kriswallsmith/assetic

components/config/definition.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ Before defining the children of an array node, you can provide options like:
228228
If called (with ``false``), keys with dashes are *not* normalized to underscores.
229229
It is recommended to use this with prototype nodes where the user will define
230230
a key-value map, to avoid an unnecessary transformation.
231+
``ignoreExtraKeys()``
232+
Allows extra config keys to be specified under an array without
233+
throwing an exception.
231234

232235
A basic prototyped array configuration can be defined as follows::
233236

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,

configuration/override_dir_structure.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ define your own templates directory (or directories):
104104
# app/config/config.yml
105105
twig:
106106
# ...
107-
paths: ["%kernel.root_dir%/../templates"]
107+
paths: ["%kernel.project_dir%/templates"]
108108
109109
.. code-block:: xml
110110
@@ -119,7 +119,7 @@ define your own templates directory (or directories):
119119
http://symfony.com/schema/dic/twig/twig-1.0.xsd">
120120
121121
<twig:config>
122-
<twig:path>%kernel.root_dir%/../templates</twig:path>
122+
<twig:path>%kernel.project_dir%/templates</twig:path>
123123
</twig:config>
124124
125125
</container>
@@ -129,7 +129,7 @@ define your own templates directory (or directories):
129129
// app/config/config.php
130130
$container->loadFromExtension('twig', array(
131131
'paths' => array(
132-
'%kernel.root_dir%/../templates',
132+
'%kernel.project_dir%/templates',
133133
),
134134
));
135135
@@ -197,7 +197,7 @@ You also need to change the ``extra.symfony-web-dir`` option in the
197197
http://symfony.com/schema/dic/assetic/assetic-1.0.xsd">
198198
199199
<!-- ... -->
200-
<assetic:config read-from="%kernel.root_dir%/../../public_html" />
200+
<assetic:config read-from="%kernel.project_dir%/../public_html" />
201201
202202
</container>
203203

contributing/code/core_team.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ Active Core Members
8181
components and the SecurityBundle_;
8282

8383
* **Maxime Steinhausser** (`ogizanagi`_) can merge into Config_, Console_,
84-
Form_, Serializer_, DependencyInjection_, and HttpKernel_ components.
84+
Form_, Serializer_, DependencyInjection_, and HttpKernel_ components;
85+
86+
* **Tobias Nyholm** (`Nyholm`) manages the official and contrib recipes
87+
repositories.
8588

8689
* **Deciders** (``@symfony/deciders`` on GitHub):
8790

@@ -223,4 +226,4 @@ discretion of the **Project Leader**.
223226
.. _`lyrixx`: https://github.com/lyrixx/
224227
.. _`chalasr`: https://github.com/chalasr/
225228
.. _`ogizanagi`: https://github.com/ogizanagi/
226-
.. _`csarrazi`: https://github.com/csarrazi/
229+
.. _`Nyholm`: https://github.com/Nyholm

contributing/code/patches.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,22 @@ Then create a new branch off the ``2.7`` branch to work on the bugfix:
157157
The above checkout commands automatically switch the code to the newly created
158158
branch (check the branch you are working on with ``git branch``).
159159

160+
Use your Branch in an Existing Project
161+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162+
163+
If you want to test your code in an existing project that uses ``symfony/symfony``
164+
or Symfony components, you can use the ``link`` utility provided in the Git repository
165+
you cloned previously.
166+
This tool scans the ``vendor/`` directory of your project, finds Symfony packages it
167+
uses, and replaces them by symbolic links to the ones in the Git repository.
168+
169+
.. code-block:: terminal
170+
171+
$ php link /path/to/your/project
172+
173+
Before running the ``link`` command, be sure that the dependencies of the project you
174+
want to debug are installed by running ``composer install`` inside it.
175+
160176
Work on your Patch
161177
~~~~~~~~~~~~~~~~~~
162178

controller/upload_file.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ to :doc:`customize form rendering </form/form_customization>`):
108108
Finally, you need to update the code of the controller that handles the form::
109109

110110
// src/AppBundle/Controller/ProductController.php
111-
namespace AppBundle\ProductController;
111+
namespace AppBundle\Controller;
112112

113113
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
114114
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

deployment.rst

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,15 @@ Using Build Scripts and other Tools
7878
There are also tools to help ease the pain of deployment. Some of them have been
7979
specifically tailored to the requirements of Symfony.
8080

81-
`Capistrano`_ with `Symfony plugin`_
82-
`Capistrano`_ is a remote server automation and deployment tool written in Ruby.
83-
`Symfony plugin`_ is a plugin to ease Symfony related tasks, inspired by `Capifony`_
84-
(which works only with Capistrano 2).
81+
`EasyDeployBundle`_
82+
A Symfony bundle that adds easy deploy tools to your application.
8583

86-
`sf2debpkg`_
87-
Helps you build a native Debian package for your Symfony project.
84+
`Deployer`_
85+
This is another native PHP rewrite of Capistrano, with some ready recipes for
86+
Symfony.
87+
88+
`Ansistrano`_
89+
An Ansible role that allows you to configure a powerful deploy via YAML files.
8890

8991
`Magallanes`_
9092
This Capistrano-like deployment tool is built in PHP, and may be easier
@@ -94,13 +96,14 @@ specifically tailored to the requirements of Symfony.
9496
This Python-based library provides a basic suite of operations for executing
9597
local or remote shell commands and uploading/downloading files.
9698

97-
`Deployer`_
98-
This is another native PHP rewrite of Capistrano, with some ready recipes for
99-
Symfony.
99+
`Capistrano`_ with `Symfony plugin`_
100+
`Capistrano`_ is a remote server automation and deployment tool written in Ruby.
101+
`Symfony plugin`_ is a plugin to ease Symfony related tasks, inspired by `Capifony`_
102+
(which works only with Capistrano 2).
103+
104+
`sf2debpkg`_
105+
Helps you build a native Debian package for your Symfony project.
100106

101-
Bundles
102-
There are some `bundles that add deployment features`_ directly into your
103-
Symfony console.
104107

105108
Basic scripting
106109
You can of course use shell, `Ant`_ or any other build tool to script
@@ -241,11 +244,12 @@ kernel and return your project's root directory::
241244
.. _`Capistrano`: http://capistranorb.com/
242245
.. _`sf2debpkg`: https://github.com/liip/sf2debpkg
243246
.. _`Fabric`: http://www.fabfile.org/
247+
.. _`Ansistrano`: https://ansistrano.com/
244248
.. _`Magallanes`: https://github.com/andres-montanez/Magallanes
245249
.. _`Ant`: http://blog.sznapka.pl/deploying-symfony2-applications-with-ant
246-
.. _`bundles that add deployment features`: https://github.com/search?utf8=✓&q=topic%3Asymfony-bundle+topic%3Adeploy&type=Repositories&ref=searchresults
247250
.. _`Memcached`: http://memcached.org/
248251
.. _`Redis`: http://redis.io/
249252
.. _`Symfony plugin`: https://github.com/capistrano/symfony/
250253
.. _`Deployer`: http://deployer.org/
251254
.. _`Git Tagging`: https://git-scm.com/book/en/v2/Git-Basics-Tagging
255+
.. _`EasyDeployBundle`: https://github.com/EasyCorp/easy-deploy-bundle

doctrine/event_listeners_subscribers.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ a ``postPersist()`` method, which will be called when the event is dispatched::
102102
{
103103
public function postPersist(LifecycleEventArgs $args)
104104
{
105-
$object = $args->getObject();
105+
$entity = $args->getEntity();
106106

107107
// only act on some "Product" entity
108-
if (!$object instanceof Product) {
108+
if (!$entity instanceof Product) {
109109
return;
110110
}
111111

112-
$objectManager = $args->getObjectManager();
112+
$entityManager = $args->getEntityManager();
113113
// ... do something with the Product
114114
}
115115
}
@@ -166,7 +166,7 @@ interface and have an event method for each event it subscribes to::
166166

167167
public function index(LifecycleEventArgs $args)
168168
{
169-
$entity = $args->getObject();
169+
$entity = $args->getEntity();
170170

171171
// perhaps you only want to act on some "Product" entity
172172
if ($entity instanceof Product) {

event_dispatcher.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ The most common way to listen to an event is to register an **event listener**::
6464

6565
Each event receives a slightly different type of ``$event`` object. For
6666
the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent`.
67-
To see what type of object each event listener receives, see :class:`Symfony\\Component\\HttpKernel\\KernelEvents`
68-
or the documentation about the specific event you're listening to.
67+
Check out the :doc:`Symfony events reference </reference/events>` to see
68+
what type of object each event provides.
6969

7070
Now that the class is created, you just need to register it as a service and
7171
notify Symfony that it is a "listener" on the ``kernel.exception`` event by

form/events.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Creating and binding an event listener to the form is very easy::
282282
return;
283283
}
284284

285-
// Check whether the user has chosen to display his email or not.
285+
// Check whether the user has chosen to display their email or not.
286286
// If the data was submitted previously, the additional value that is
287287
// included in the request variables needs to be removed.
288288
if (true === $user['show_email']) {
@@ -363,7 +363,7 @@ Event subscribers have different uses:
363363
$form = $event->getForm();
364364
365365
// Check whether the user from the initial data has chosen to
366-
// display his email or not.
366+
// display their email or not.
367367
if (true === $user->isShowEmail()) {
368368
$form->add('email', EmailType::class);
369369
}
@@ -378,7 +378,7 @@ Event subscribers have different uses:
378378
return;
379379
}
380380
381-
// Check whether the user has chosen to display his email or not.
381+
// Check whether the user has chosen to display their email or not.
382382
// If the data was submitted previously, the additional value that
383383
// is included in the request variables needs to be removed.
384384
if (true === $user['show_email']) {

form/without_class.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ an array.
6363
Adding Validation
6464
-----------------
6565

66-
The only missing piece is validation. Usually, when you call ``$form->isValid()``,
66+
The only missing piece is validation. Usually, when you call ``$form->handleRequest($request)``,
6767
the object is validated by reading the constraints that you applied to that
6868
class. If your form is mapped to an object (i.e. you're using the ``data_class``
6969
option or passing an object to your form), this is almost always the approach

frontend/encore/css-preprocessors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ can also pass options to ``sass-loader``:
3232
3333
Encore
3434
// ...
35-
.enableSassLoader(function(sassOptions) {
35+
.enableSassLoader(function(options) {
3636
// https://github.com/sass/node-sass#options
3737
// options.includePaths = [...]
3838
});

frontend/encore/installation.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,23 @@ Then, install Encore into your project with Yarn:
1111
1212
.. note::
1313

14-
If you want to use `npm`_ instead of `yarn`_, replace ``yarn add xxx --dev`` by
15-
``npm install xxx --save-dev``.
14+
If you want to use `npm`_ instead of `yarn`_:
15+
16+
.. code-block:: terminal
17+
18+
$ npm install @symfony/webpack-encore --save-dev
1619
1720
.. tip::
1821

19-
If you are using Flex for your project, you can install Encore via:
22+
If you are using Flex for your project, you can initialize your project for Encore via:
2023

2124
.. code-block:: terminal
2225
2326
$ composer require encore
27+
$ yarn install
28+
29+
This will create a ``webpack.config.js`` file, add the ``assets/`` directory, and add ``node_modules/`` to
30+
``.gitignore``.
2431

2532
This command creates (or modifies) a ``package.json`` file and downloads dependencies
2633
into a ``node_modules/`` directory. When using Yarn, a file called ``yarn.lock``

0 commit comments

Comments
 (0)