Skip to content

Commit d74eb9d

Browse files
committed
Merge branch '4.4'
* 4.4: [DomCrawler] Add hint about Form::getName method
2 parents 32adb8e + 96b755e commit d74eb9d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

components/dom_crawler.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,12 @@ The :class:`Symfony\\Component\\DomCrawler\\Form` object has lots of very
486486
useful methods for working with forms::
487487

488488
$uri = $form->getUri();
489-
490489
$method = $form->getMethod();
490+
$name = $form->getName();
491+
492+
.. versionadded:: 4.4
493+
494+
The ``getName()`` method was introduced in Symfony 4.4.
491495

492496
The :method:`Symfony\\Component\\DomCrawler\\Form::getUri` method does more
493497
than just return the ``action`` attribute of the form. If the form method

testing.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,17 @@ their type::
804804
$form['my_form[field][O]']->upload('/path/to/lucas.jpg');
805805
$form['my_form[field][1]']->upload('/path/to/lisa.jpg');
806806

807+
.. tip::
808+
809+
Instead of hardcoding the form name as part of the field names (e.g.
810+
``my_form[...]`` in previous examples), you can use the
811+
:method:`Symfony\\Component\\DomCrawler\\Form::getName` method to get the
812+
form name.
813+
814+
.. versionadded:: 4.4
815+
816+
The ``getName()`` method was introduced in Symfony 4.4.
817+
807818
.. tip::
808819

809820
If you purposefully want to select "invalid" select/radio values, see

0 commit comments

Comments
 (0)