Skip to content

Commit a08f789

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Add information about strict_mode for encore [Security] Added a note regarding the loginUser() method Note that env vars are not always compatible with options Update autowiring.rst Explaining how to inject the form factory
2 parents 01ca356 + c58d741 commit a08f789

File tree

5 files changed

+45
-10
lines changed

5 files changed

+45
-10
lines changed

components/form.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,6 @@ you need to. If your application uses global or static variables (not usually a
371371
good idea), then you can store the object on some static class or do something
372372
similar.
373373

374-
Regardless of how you architect your application, remember that you
375-
should only have one form factory and that you'll need to be able to access
376-
it throughout your application.
377-
378374
.. _component-form-intro-create-simple-form:
379375

380376
Creating a simple Form
@@ -383,7 +379,8 @@ Creating a simple Form
383379
.. tip::
384380

385381
If you're using the Symfony Framework, then the form factory is available
386-
automatically as a service called ``form.factory``. Also, the default
382+
automatically as a service called ``form.factory``, you can inject it as
383+
``Symfony\Component\Form\FormFactoryInterface``. Also, the default
387384
base controller class has a :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController::createFormBuilder`
388385
method, which is a shortcut to fetch the form factory and call ``createBuilder()``
389386
on it.

configuration.rst

+12-3
Original file line numberDiff line numberDiff line change
@@ -593,9 +593,10 @@ configure options that depend on where the application is run (e.g. the database
593593
credentials are usually different in production versus your local machine). If
594594
the values are sensitive, you can even :doc:`encrypt them as secrets </configuration/secrets>`.
595595

596-
You can reference environment variables using the special syntax
597-
``%env(ENV_VAR_NAME)%``. The values of these options are resolved at runtime
598-
(only once per request, to not impact performance).
596+
Use the special syntax ``%env(ENV_VAR_NAME)%`` to reference environment variables.
597+
The values of these options are resolved at runtime (only once per request, to
598+
not impact performance) so you can change the application behavior without having
599+
to clear the cache.
599600

600601
This example shows how you could configure the database connection using an env var:
601602

@@ -662,6 +663,14 @@ To define the value of an env var, you have several options:
662663
Some hosts - like SymfonyCloud - offer easy `utilities to manage env vars`_
663664
in production.
664665

666+
.. note::
667+
668+
Some configuration features are not compatible with env vars. For example,
669+
defining some container parameters conditionally based on the existence of
670+
another configuration option. When using an env var, the configuration option
671+
always exists, because its value will be ``null`` when the related env var
672+
is not defined.
673+
665674
.. caution::
666675

667676
Beware that dumping the contents of the ``$_SERVER`` and ``$_ENV`` variables

frontend/encore/faq.rst

+25
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,28 @@ running it (e.g. when executing ``yarn encore dev``). Fix this issue calling to
169169
// ... the rest of the Encore configuration
170170
171171
.. _`Webpack integration in PhpStorm`: https://www.jetbrains.com/help/phpstorm/using-webpack.html
172+
173+
My Tests are Failing Because of ``entrypoints.json`` File
174+
---------------------------------------------------------
175+
176+
After installing Encore, you might see the following error when running tests
177+
locally or on your Continuous Integration server:
178+
179+
.. code-block:: text
180+
181+
Uncaught PHP Exception Twig\Error\RuntimeError:
182+
"An exception has been thrown during the rendering of a template
183+
("Could not find the entrypoints file from Webpack:
184+
the file "/var/www/html/public/build/entrypoints.json" does not exist.
185+
186+
This is happening because you did not build your Encore assets, hence no
187+
``entrypoints.json`` file. To solve this error, either build Encore assets or
188+
set the ``strict_mode`` option to ``false`` (this prevents Encore's Twig
189+
functions to trigger exceptions when there's no ``entrypoints.json`` file):
190+
191+
.. code-block:: yaml
192+
193+
# config/packages/test/webpack_encore.yaml
194+
webpack_encore:
195+
strict_mode: false
196+
# ...

service_container/autowiring.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,7 @@ dealing with the ``TransformerInterface``.
369369
.. tip::
370370

371371
When using a `service definition prototype`_, if only one service is
372-
discovered that implements an interface, and that interface is also
373-
discovered in the same file, configuring the alias is not mandatory
372+
discovered that implements an interface, configuring the alias is not mandatory
374373
and Symfony will automatically create one.
375374

376375
Dealing with Multiple Implementations of the Same Type

testing.rst

+5
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,11 @@ You can pass any
621621
:class:`Symfony\\Bundle\\FrameworkBundle\\Test\\TestBrowserToken` object and
622622
stores in the session of the test client.
623623

624+
.. note::
625+
626+
By design, the ``loginUser()`` method doesn't work when using stateless firewalls.
627+
Instead, add the appropriate token/header in each ``request()`` call.
628+
624629
Making AJAX Requests
625630
....................
626631

0 commit comments

Comments
 (0)