Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3b3cd6f

Browse files
committed
Added references
1 parentf36fdb7 commit3b3cd6f

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

‎components/form/type_guesser.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,26 @@ set.
144144
float (e.g. you want a float to be greater than ``5``, ``4.512313`` is not valid
145145
but ``length(4.512314) > length(5)`` is, so the pattern will success). In
146146
this case, the value should be set to ``null`` with a ``MEDIUM_CONFIDENCE``.
147+
148+
Registering a Type Guesser
149+
--------------------------
150+
151+
The last thing you need to do is registering your custom type guesser by using
152+
:method:`Symfony\\Component\\Form\\FormFactoryBuilder::addTypeGuesser` or
153+
:method:`Symfony\\Component\\Form\\FormFactoryBuilder::addTypeGuessers`::
154+
155+
use Symfony\Component\Form\Forms;
156+
use Acme\Form\PHPDocTypeGuesser;
157+
158+
$formFactory = Forms::createFormFactoryBuilder()
159+
// ...
160+
->addTypeGuesser(new PHPDocTypeGuesser())
161+
->getFormFactory();
162+
163+
// ...
164+
165+
..note::
166+
167+
When you use the full stack framework, you need to register your type
168+
guesser and tag it with ``form.type_guesser``. For more information see
169+
:ref:`the tag reference<reference-dic-type_guesser>`.

‎reference/dic_tags.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,21 +332,22 @@ The ``alias`` key of the tag is the type of field that this extension should
332332
be applied to. For example, to apply the extension to any form/field, use the
333333
"form" value.
334334
335+
.. _reference-dic-type_guesser:
336+
335337
form.type_guesser
336338
-----------------
337339
338340
**Purpose**: Add your own logic for"form type guessing"
339341
340342
This tag allows you to add your own logic to the :ref:`Form Guessing <book-forms-field-guessing>`
341343
process. By default, form guessing is done by"guessers" based on the validation
342-
metadata and Doctrine metadata (if you're using Doctrine).
344+
metadata and Doctrine metadata (if you're using Doctrine) or Propel metadata
345+
(if you're using Propel).
343346
344-
To add your own form type guesser, create a class that implements the
345-
:class:`Symfony\\Component\\Form\\FormTypeGuesserInterface` interface. Next,
346-
tag its service definition with ``form.type_guesser`` (it has no options).
347+
.. seelalso::
347348
348-
To see an example ofhowthis class might look, see the ``ValidatorTypeGuesser``
349-
class in the Form component.
349+
For information onhowto create your own type guesser, see
350+
:doc:`/components/form/type_guesser`.
350351
351352
kernel.cache_clearer
352353
--------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp