File tree 3 files changed +24
-5
lines changed
3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,23 @@ method. This is done using the index notation that is used in PHP::
47
47
var_dump($propertyAccessor->getValue($person, '[first_name]')); // 'Wouter'
48
48
var_dump($propertyAccessor->getValue($person, '[age]')); // null
49
49
50
- As you can see, the method will return ``null `` if the index does not exists.
50
+ As you can see, the method will return ``null `` if the index does not exist.
51
+ But you can change this behavior with the
52
+ :method: `Symfony\\ Component\\ PropertyAccess\\ PropertyAccessorBuilder::enableExceptionOnInvalidIndex `
53
+ method::
54
+
55
+ // ...
56
+ $propertyAccessor = PropertyAccess::createPropertyAccessorBuilder()
57
+ ->enableExceptionOnInvalidIndex()
58
+ ->getPropertyAccessor();
59
+
60
+ $person = array(
61
+ 'first_name' => 'Wouter',
62
+ );
63
+
64
+ // instead of returning null, the code now throws an exception of type
65
+ // Symfony\Component\PropertyAccess\Exception\NoSuchIndexException
66
+ $value = $propertyAccessor->getValue($person, '[age]');
51
67
52
68
You can also use multi dimensional arrays::
53
69
Original file line number Diff line number Diff line change @@ -121,13 +121,13 @@ application harder to maintain.
121
121
cache
122
122
~~~~~
123
123
124
- **type **: ``string `` **default **: ``'%kernel.cache_dir%/twig' ``
124
+ **type **: ``string `` | `` false `` | `` Twig\Cache\CacheInterface `` **default **: ``'%kernel.cache_dir%/twig' ``
125
125
126
126
Before using the Twig templates to render some contents, they are compiled into
127
127
regular PHP code. Compilation is a costly process, so the result is cached in
128
128
the directory defined by this configuration option.
129
129
130
- Set this option to ``null `` to disable Twig template compilation. However, this
130
+ Set this option to ``false `` to disable Twig template compilation. However, this
131
131
is not recommended; not even in the ``dev `` environment, because the
132
132
``auto_reload `` option ensures that cached templates which have changed get
133
133
compiled again.
Original file line number Diff line number Diff line change @@ -9,8 +9,9 @@ The TextType field represents the most basic input text field.
9
9
+-------------+--------------------------------------------------------------------+
10
10
| Rendered as | ``input `` ``text `` field |
11
11
+-------------+--------------------------------------------------------------------+
12
- | Inherited | - `data `_ |
13
- | options | - `disabled `_ |
12
+ | Inherited | - `attr `_ |
13
+ | options | - `data `_ |
14
+ | | - `disabled `_ |
14
15
| | - `empty_data `_ |
15
16
| | - `error_bubbling `_ |
16
17
| | - `error_mapping `_ |
@@ -34,6 +35,8 @@ Inherited Options
34
35
35
36
These options inherit from the :doc: `FormType </reference/forms/types/form >`:
36
37
38
+ .. include :: /reference/forms/types/options/attr.rst.inc
39
+
37
40
.. include :: /reference/forms/types/options/data.rst.inc
38
41
39
42
.. include :: /reference/forms/types/options/disabled.rst.inc
You can’t perform that action at this time.
0 commit comments