File tree 5 files changed +45
-10
lines changed
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
371
371
good idea), then you can store the object on some static class or do something
372
372
similar.
373
373
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
-
378
374
.. _component-form-intro-create-simple-form :
379
375
380
376
Creating a simple Form
@@ -383,7 +379,8 @@ Creating a simple Form
383
379
.. tip ::
384
380
385
381
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
387
384
base controller class has a :method: `Symfony\\ Bundle\\ FrameworkBundle\\ Controller\\ AbstractController::createFormBuilder `
388
385
method, which is a shortcut to fetch the form factory and call ``createBuilder() ``
389
386
on it.
Original file line number Diff line number Diff line change @@ -593,9 +593,10 @@ configure options that depend on where the application is run (e.g. the database
593
593
credentials are usually different in production versus your local machine). If
594
594
the values are sensitive, you can even :doc: `encrypt them as secrets </configuration/secrets >`.
595
595
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.
599
600
600
601
This example shows how you could configure the database connection using an env var:
601
602
@@ -662,6 +663,14 @@ To define the value of an env var, you have several options:
662
663
Some hosts - like SymfonyCloud - offer easy `utilities to manage env vars `_
663
664
in production.
664
665
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
+
665
674
.. caution ::
666
675
667
676
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
169
169
// ... the rest of the Encore configuration
170
170
171
171
.. _`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``.
369
369
.. tip ::
370
370
371
371
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
374
373
and Symfony will automatically create one.
375
374
376
375
Dealing 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
621
621
:class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ TestBrowserToken ` object and
622
622
stores in the session of the test client.
623
623
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
+
624
629
Making AJAX Requests
625
630
....................
626
631
You can’t perform that action at this time.
0 commit comments