Skip to content

Commit 2b85af5

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: Teach the user to write the command lazy loading [#10480] reuse wording from multi kernel article Update Multiple_kernels.rst Update usage.rst add annotation block to routing conditions fix the markup Clarifying what happens with --env=prod + APP_ENV=prod Fix example for collection form type Update micro_kernel_trait.rst Update configuration/micro_kernel_trait.rst Update to micro_kernel_trait.rst
2 parents 0fe8709 + d781027 commit 2b85af5

File tree

6 files changed

+53
-23
lines changed

6 files changed

+53
-23
lines changed

configuration/dot-env-changes.rst

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ important changes:
3030
other environments. You can also create a ``.env.test`` file for test-environment
3131
overrides.
3232

33+
* E) If you pass the ``--env=`` flag when running ``bin/console``, this value will
34+
override your ``APP_ENV`` environment variable (if set). And so, if you pass
35+
``--env=prod``, the DotEnv component *will* try to load your ``.env*`` files.
36+
3337
There are a few other improvements, but these are the most important. To take advantage
3438
of these, you *will* need to modify a few files in your existing app.
3539

@@ -52,29 +56,29 @@ changes can be made to any Symfony 3.4 or higher app:
5256

5357
#. Update ``.gitignore``:
5458

55-
.. code-block:: diff
59+
.. code-block:: diff
5660
57-
# .gitignore
58-
# ...
61+
# .gitignore
62+
# ...
5963
60-
###> symfony/framework-bundle ###
61-
- /.env
62-
+ /.env.local
63-
+ /.env.*.local
64+
###> symfony/framework-bundle ###
65+
- /.env
66+
+ /.env.local
67+
+ /.env.*.local
6468
65-
# ...
69+
# ...
6670
6771
#. Rename ``.env`` to ``.env.local`` and ``.env.dist`` to ``.env``:
6872

69-
.. code-block:: terminal
73+
.. code-block:: terminal
7074
71-
# Unix
72-
$ mv .env .env.local
73-
$ git mv .env.dist .env
75+
# Unix
76+
$ mv .env .env.local
77+
$ git mv .env.dist .env
7478
75-
# Windows
76-
$ mv .env .env.local
77-
$ git mv .env.dist .env
79+
# Windows
80+
$ mv .env .env.local
81+
$ git mv .env.dist .env
7882
7983
You can also update the `comment on the top of .env`_ to reflect the new changes.
8084

configuration/micro_kernel_trait.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ your ``composer.json`` file to load from there:
124124
}
125125
}
126126
127+
Then, run ``composer dump-autoload`` to dump your new autoload config.
128+
127129
Now, suppose you want to use Twig and load routes via annotations. Instead of
128130
putting *everything* in ``index.php``, create a new ``src/Kernel.php`` to
129131
hold the kernel. Now it looks like this::

console.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ want a command to create a user::
3535

3636
class CreateUserCommand extends Command
3737
{
38+
// the name of the command (the part after "bin/console")
39+
protected static $defaultName = 'app:create-user';
40+
3841
protected function configure()
3942
{
4043
// ...
@@ -57,9 +60,6 @@ method. Then you can optionally define a help message and the
5760
protected function configure()
5861
{
5962
$this
60-
// the name of the command (the part after "bin/console")
61-
->setName('app:create-user')
62-
6363
// the short description shown while running "php bin/console list"
6464
->setDescription('Creates a new user.')
6565

reference/forms/types/collection.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,8 @@ you need is this JavaScript code:
148148
jQuery(document).ready(function () {
149149
jQuery('.add-another-collection-widget').click(function (e) {
150150
var list = jQuery(jQuery(this).attr('data-list'));
151-
// Try to find the counter of the list
151+
// Try to find the counter of the list or use the length of the list
152152
var counter = list.data('widget-counter') | list.children().length;
153-
// If the counter does not exist, use the length of the list
154-
if (!counter) { counter = list.children().length; }
155153
156154
// grab the prototype template
157155
var newWidget = list.attr('data-prototype');
@@ -162,7 +160,7 @@ you need is this JavaScript code:
162160
// Increase the counter
163161
counter++;
164162
// And store it, the length cannot be used if deleting widgets is allowed
165-
list.data(' widget-counter', counter);
163+
list.data('widget-counter', counter);
166164
167165
// create a new list element and add it to the list
168166
var newElem = jQuery(list.attr('data-widget-tags')).html(newWidget);

routing/conditions.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,32 @@ define arbitrary matching logic, use the ``conditions`` routing option:
1010

1111
.. configuration-block::
1212

13+
.. code-block:: php-annotations
14+
15+
// src/Controller/DefaultController.php
16+
namespace App\Controller;
17+
18+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
19+
use Symfony\Component\Routing\Annotation\Route;
20+
21+
class DefaultController extends AbstractController
22+
{
23+
/**
24+
* @Route(
25+
* "/contact",
26+
* name="contact",
27+
* condition="context.getMethod() in ['GET', 'HEAD'] and request.headers.get('User-Agent') matches '/firefox/i'"
28+
* )
29+
*
30+
* expressions can also include config parameters
31+
* condition: "request.headers.get('User-Agent') matches '%app.allowed_browsers%'"
32+
*/
33+
public function contact()
34+
{
35+
// ...
36+
}
37+
}
38+
1339
.. code-block:: yaml
1440
1541
# config/routes.yaml

workflow/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ The following example shows these functions in action:
467467
{% endfor %}
468468
469469
{# Check if the object is in some specific place #}
470-
{% if workflow_has_marked_place(post, 'to_review') %}
470+
{% if workflow_has_marked_place(post, 'review') %}
471471
<p>This post is ready for review.</p>
472472
{% endif %}
473473

0 commit comments

Comments
 (0)