Skip to content

Commit e01ba27

Browse files
committed
minor #13483 [Form] Renaming the article (ThomasLandauer)
This PR was submitted for the 3.4 branch but it was squashed and merged into the 4.4 branch instead. Discussion ---------- [Form] Renaming the article Reason: If you read "How to Embed a Collection of Forms" at https://symfony.com/doc/3.4/forms.html#learn-more it doesn't really reveal what this is all about. So I changed the title to something which describes it better from the user's point of view. I also removed all occurrences of "you" in the first paragraph, see #13445 (comment) Commits ------- e9cc299 [Form] Renaming the article
2 parents fb7df00 + e9cc299 commit e01ba27

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

form/form_collections.rst

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
.. index::
22
single: Form; Embed collection of forms
33

4-
How to Embed a Collection of Forms
5-
==================================
4+
Edit Related Entities in a Single Form
5+
======================================
66

7-
In this article, you'll learn how to create a form that embeds a collection
8-
of many other forms. This could be useful, for example, if you had a ``Task``
9-
class and you wanted to edit/create/remove many ``Tag`` objects related to
10-
that Task, right inside the same form.
7+
To edit associated entities in the same form, Symfony has the concept of
8+
Form "Collections". Think of it as a series of sub-forms, embedded into
9+
the main form.
1110

12-
Let's start by creating a ``Task`` entity::
11+
The example used in this article is a ``Task`` entity that relates to
12+
a ``Tag`` entitiy. The goal is to create a single form for tasks, that
13+
also allows to edit/create/remove many tags associated with that task.
14+
15+
Here's the ``Task`` and the ``Tag`` entity::
1316

1417
// src/Entity/Task.php
1518
namespace App\Entity;
@@ -45,12 +48,10 @@ Let's start by creating a ``Task`` entity::
4548

4649
.. note::
4750

48-
The ``ArrayCollection`` is specific to Doctrine and is basically the
49-
same as using an ``array`` (but it must be an ``ArrayCollection`` if
50-
you're using Doctrine).
51+
The `ArrayCollection`_ is specific to Doctrine and is basically the
52+
same as using an ``array``.
5153

52-
Now, create a ``Tag`` class. As you saw above, a ``Task`` can have many ``Tag``
53-
objects::
54+
.. code-block:: php
5455
5556
// src/Entity/Tag.php
5657
namespace App\Entity;
@@ -688,3 +689,4 @@ the relationship between the removed ``Tag`` and ``Task`` object.
688689
.. _`JSFiddle`: http://jsfiddle.net/847Kf/4/
689690
.. _`@a2lix/symfony-collection`: https://github.com/a2lix/symfony-collection
690691
.. _`symfony-collection`: https://github.com/ninsuo/symfony-collection
692+
.. _`ArrayCollection`: https://www.doctrine-project.org/projects/doctrine-collections/en/1.6/index.html

0 commit comments

Comments
 (0)