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

Create data_class.rst.inc #2362 #3334

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions reference/forms/types/entity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ objects from the database.
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
+-------------+------------------------------------------------------------------+
| Options | - `class`_ |
| | - `data_class`_ |
| | - `property`_ |
| | - `group_by`_ |
| | - `query_builder`_ |
Expand Down Expand Up @@ -103,6 +104,8 @@ 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).

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

property
~~~~~~~~

Expand Down
11 changes: 11 additions & 0 deletions reference/forms/types/options/data_class.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
data_class
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should add a versionadded directive before this line:

.. versionadded:: 2.4
    The ``data_class`` option was introduced in Symfony 2.4.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this isn't correct, right? The data_class option has always existed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~~~~~~~~~~

**type**: ``string``

This option is used to set the appropriate data mapper to be used by the form,
so you can use it for any form field type which requires an object.

$builder->add('media', 'sonata_media_type', array(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if using a 3th party type is what we want

'data_class' => 'Acme\DemoBundle\Entity\Media',
));