File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Expand file tree Collapse file tree 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::
4747 var_dump($propertyAccessor->getValue($person, '[first_name]')); // 'Wouter'
4848 var_dump($propertyAccessor->getValue($person, '[age]')); // null
4949
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]');
5167
5268You can also use multi dimensional arrays::
5369
Original file line number Diff line number Diff line change @@ -121,13 +121,13 @@ application harder to maintain.
121121cache
122122~~~~~
123123
124- **type **: ``string `` **default **: ``'%kernel.cache_dir%/twig' ``
124+ **type **: ``string `` | `` false `` | `` Twig\Cache\CacheInterface `` **default **: ``'%kernel.cache_dir%/twig' ``
125125
126126Before using the Twig templates to render some contents, they are compiled into
127127regular PHP code. Compilation is a costly process, so the result is cached in
128128the directory defined by this configuration option.
129129
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
131131is not recommended; not even in the ``dev `` environment, because the
132132``auto_reload `` option ensures that cached templates which have changed get
133133compiled 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.
99+-------------+--------------------------------------------------------------------+
1010| Rendered as | ``input `` ``text `` field |
1111+-------------+--------------------------------------------------------------------+
12- | Inherited | - `data `_ |
13- | options | - `disabled `_ |
12+ | Inherited | - `attr `_ |
13+ | options | - `data `_ |
14+ | | - `disabled `_ |
1415| | - `empty_data `_ |
1516| | - `error_bubbling `_ |
1617| | - `error_mapping `_ |
@@ -34,6 +35,8 @@ Inherited Options
3435
3536These options inherit from the :doc: `FormType </reference/forms/types/form >`:
3637
38+ .. include :: /reference/forms/types/options/attr.rst.inc
39+
3740.. include :: /reference/forms/types/options/data.rst.inc
3841
3942.. include :: /reference/forms/types/options/disabled.rst.inc
You can’t perform that action at this time.
0 commit comments