Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Form] reorder EntityType options #6330

Merged
merged 1 commit into from
Mar 8, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions reference/forms/types/entity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ objects from the database.
+-------------+------------------------------------------------------------------+
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
+-------------+------------------------------------------------------------------+
| Options | - `class`_ |
| | - `choice_label`_ |
| | - `query_builder`_ |
| Options | - `choice_label`_ |
| | - `class`_ |
| | - `em`_ |
| | - `query_builder`_ |
+-------------+------------------------------------------------------------------+
| Overridden | - `choices`_ |
| options | - `data_class`_ |
+-------------+------------------------------------------------------------------+
| Inherited | from the :doc:`choice </reference/forms/types/choice>` type: |
| options | |
| | - `choice_value`_ |
| | - `choice_name`_ |
| | - `choice_attr`_ |
| | - `placeholder`_ |
| | - `choice_name`_ |
| | - `choice_translation_domain`_ |
| | - `translation_domain`_ |
| | - `choice_value`_ |
| | - `expanded`_ |
| | - `group_by`_ |
| | - `multiple`_ |
| | - `placeholder`_ |
| | - `preferred_choices`_ |
| | - `group_by`_ |
| | - `translation_domain`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type: |
| | |
Expand Down Expand Up @@ -108,15 +108,6 @@ then you can supply the ``choices`` option directly::
Field Options
-------------

class
~~~~~

**type**: ``string`` **required**

The class of your entity (e.g. ``AcmeStoreBundle:Category``). This can be
a fully-qualified class name (e.g. ``Acme\StoreBundle\Entity\Category``)
or the short alias name (as shown prior).

choice_label
~~~~~~~~~~~~

Expand Down Expand Up @@ -161,16 +152,14 @@ more detais, see the main :ref:`choice_label <reference-form-choice-label>` docu
'choice_label' => 'translations[en].name',
));

query_builder
~~~~~~~~~~~~~
class
~~~~~

**type**: ``Doctrine\ORM\QueryBuilder`` or a Closure
**type**: ``string`` **required**

If specified, this is used to query the subset of options (and their
order) that should be used for the field. The value of this option can
either be a ``QueryBuilder`` object or a Closure. If using a Closure,
it should take a single argument, which is the ``EntityRepository`` of
the entity and return an instance of ``QueryBuilder``.
The class of your entity (e.g. ``AcmeStoreBundle:Category``). This can be
a fully-qualified class name (e.g. ``Acme\StoreBundle\Entity\Category``)
or the short alias name (as shown prior).

em
~~
Expand All @@ -180,6 +169,17 @@ em
If specified, this entity manager will be used to load the choices
instead of the ``default`` entity manager.

query_builder
~~~~~~~~~~~~~

**type**: ``Doctrine\ORM\QueryBuilder`` or a Closure

If specified, this is used to query the subset of options (and their
order) that should be used for the field. The value of this option can
either be a ``QueryBuilder`` object or a Closure. If using a Closure,
it should take a single argument, which is the ``EntityRepository`` of
the entity and return an instance of ``QueryBuilder``.

Overridden Options
------------------

Expand All @@ -206,20 +206,18 @@ Inherited Options
These options inherit from the :doc:`choice </reference/forms/types/choice>`
type:

.. include:: /reference/forms/types/options/choice_value.rst.inc

.. include:: /reference/forms/types/options/choice_name.rst.inc

.. include:: /reference/forms/types/options/choice_attr.rst.inc

.. include:: /reference/forms/types/options/placeholder.rst.inc
.. include:: /reference/forms/types/options/choice_name.rst.inc

.. include:: /reference/forms/types/options/choice_translation_domain.rst.inc

.. include:: /reference/forms/types/options/choice_type_translation_domain.rst.inc
.. include:: /reference/forms/types/options/choice_value.rst.inc

.. include:: /reference/forms/types/options/expanded.rst.inc

.. include:: /reference/forms/types/options/group_by.rst.inc

.. include:: /reference/forms/types/options/multiple.rst.inc

.. note::
Expand All @@ -230,7 +228,7 @@ type:
is a complete example in the cookbook article
:doc:`/cookbook/form/form_collections`.

.. include:: /reference/forms/types/options/group_by.rst.inc
.. include:: /reference/forms/types/options/placeholder.rst.inc

.. include:: /reference/forms/types/options/preferred_choices.rst.inc

Expand All @@ -239,6 +237,8 @@ type:
This option expects an array of entity objects, unlike the ``choice``
field that requires an array of keys.

.. include:: /reference/forms/types/options/choice_type_translation_domain.rst.inc

These options inherit from the :doc:`form </reference/forms/types/form>`
type:

Expand Down