File tree Expand file tree Collapse file tree 5 files changed +45
-10
lines changed Expand file tree Collapse file tree 5 files changed +45
-10
lines changed Original file line number Diff line number Diff line change @@ -371,10 +371,6 @@ you need to. If your application uses global or static variables (not usually a
371371good idea), then you can store the object on some static class or do something
372372similar.
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
380376Creating 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.
Original file line number Diff line number Diff line change @@ -571,9 +571,10 @@ configure options that depend on where the application is run (e.g. the database
571571credentials are usually different in production versus your local machine). If
572572the values are sensitive, you can even :doc: `encrypt them as secrets </configuration/secrets >`.
573573
574- You can reference environment variables using the special syntax
575- ``%env(ENV_VAR_NAME)% ``. The values of these options are resolved at runtime
576- (only once per request, to not impact performance).
574+ Use the special syntax ``%env(ENV_VAR_NAME)% `` to reference environment variables.
575+ The values of these options are resolved at runtime (only once per request, to
576+ not impact performance) so you can change the application behavior without having
577+ to clear the cache.
577578
578579This example shows how you could configure the database connection using an env var:
579580
@@ -640,6 +641,14 @@ To define the value of an env var, you have several options:
640641 Some hosts - like SymfonyCloud - offer easy `utilities to manage env vars `_
641642 in production.
642643
644+ .. note ::
645+
646+ Some configuration features are not compatible with env vars. For example,
647+ defining some container parameters conditionally based on the existence of
648+ another configuration option. When using an env var, the configuration option
649+ always exists, because its value will be ``null `` when the related env var
650+ is not defined.
651+
643652.. caution ::
644653
645654 Beware that dumping the contents of the ``$_SERVER `` and ``$_ENV `` variables
Original file line number Diff line number Diff 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+ # ...
Original file line number Diff line number Diff 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
376375Dealing with Multiple Implementations of the Same Type
Original file line number Diff line number Diff line change @@ -621,6 +621,11 @@ You can pass any
621621:class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ TestBrowserToken ` object and
622622stores 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+
624629Making AJAX Requests
625630....................
626631
You can’t perform that action at this time.
0 commit comments