Skip to content

Commit 55017bf

Browse files
committed
Merge branch '2.8' into 3.4
* 2.8: Fixed the type of the twig.cache config option Documented the enableExceptionOnInvalidIndex() method Added the missing attr option in TextType
2 parents 377e322 + 24816e5 commit 55017bf

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

components/property_access.rst

+17-1
Original file line numberDiff line numberDiff 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

5268
You can also use multi dimensional arrays::
5369

reference/configuration/twig.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ application harder to maintain.
121121
cache
122122
~~~~~
123123

124-
**type**: ``string`` **default**: ``'%kernel.cache_dir%/twig'``
124+
**type**: ``string`` | ``false`` | ``Twig\Cache\CacheInterface`` **default**: ``'%kernel.cache_dir%/twig'``
125125

126126
Before using the Twig templates to render some contents, they are compiled into
127127
regular PHP code. Compilation is a costly process, so the result is cached in
128128
the 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
131131
is not recommended; not even in the ``dev`` environment, because the
132132
``auto_reload`` option ensures that cached templates which have changed get
133133
compiled again.

reference/forms/types/text.rst

+5-2
Original file line numberDiff line numberDiff 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

3536
These 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

0 commit comments

Comments
 (0)