File tree Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ The Dotenv Component
6
6
====================
7
7
8
8
The Dotenv Component parses ``.env `` files to make environment variables
9
- stored in them accessible via ``getenv() ``, `` $_ENV `` or ``$_SERVER ``.
9
+ stored in them accessible via ``$_ENV `` or ``$_SERVER ``.
10
10
11
11
Installation
12
12
------------
@@ -51,10 +51,10 @@ Given the following ``.env`` file content:
51
51
DB_USER=root
52
52
DB_PASS=pass
53
53
54
- Access the value with ``getenv() `` in your code::
54
+ Access the value with ``$_ENV `` in your code::
55
55
56
- $dbUser = getenv( 'DB_USER') ;
57
- // you can also use ``$_ENV`` or ``$ _SERVER``
56
+ $dbUser = $_ENV[ 'DB_USER'] ;
57
+ // you can also use ``$_SERVER``
58
58
59
59
The ``load() `` method never overwrites existing environment variables. Use the
60
60
``overload() `` method if you need to overwrite them::
Original file line number Diff line number Diff line change @@ -691,7 +691,23 @@ the choice is ultimately up to you.
691
691
.. note ::
692
692
693
693
The form name is automatically generated from the type class name. If you want
694
- to modify it, use the :method: `Symfony\\ Component\\ Form\\ FormFactoryInterface::createNamed ` method.
694
+ to modify it, use the :method: `Symfony\\ Component\\ Form\\ FormFactoryInterface::createNamed ` method::
695
+
696
+ // src/AppBundle/Controller/DefaultController.php
697
+ use AppBundle\Form\TaskType;
698
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
699
+
700
+ class DefaultController extends AbstractController
701
+ {
702
+ public function newAction()
703
+ {
704
+ $task = ...;
705
+ $form = $this->get('form.factory')->createNamed('name', TaskType::class, $task);
706
+
707
+ // ...
708
+ }
709
+ }
710
+
695
711
You can even suppress the name completely by setting it to an empty string.
696
712
697
713
Final Thoughts
Original file line number Diff line number Diff line change @@ -4,14 +4,14 @@ Traverse
4
4
Objects do not validate nested objects by default unless explicitly using
5
5
this constraint.
6
6
If only specific nested objects should be validated by cascade, consider
7
- using the :doc: `references /constraints/Valid ` instead.
7
+ using the :doc: `reference /constraints/Valid ` instead.
8
8
9
9
+----------------+-------------------------------------------------------------------------------------+
10
10
| Applies to | :ref: `class <validation-class-target >` |
11
11
+----------------+-------------------------------------------------------------------------------------+
12
12
| Options | - `payload `_ |
13
13
+----------------+-------------------------------------------------------------------------------------+
14
- | Class | :class: `Symfony\\ Bridge \\ Doctrine \\ Validator\\ Constraints\\ Traverse ` |
14
+ | Class | :class: `Symfony\C omponent \ V alidator\C onstraints\T raverse ` |
15
15
+----------------+-------------------------------------------------------------------------------------+
16
16
17
17
Basic Usage
You can’t perform that action at this time.
0 commit comments