Skip to content

Commit 75ca707

Browse files
committed
Merge branch '5.0'
* 5.0: Update Associations with fix code-block example
2 parents 19ef1b6 + 6cf75dd commit 75ca707

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

doctrine/associations.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ In this case, you'll need a ``Category`` class, and a way to relate a
4141

4242
Start by creating a ``Category`` entity with a ``name`` field:
4343

44-
.. code-block:: terminal
44+
.. code-block:: bash
4545
4646
$ php bin/console make:entity Category
4747
@@ -64,6 +64,8 @@ Start by creating a ``Category`` entity with a ``name`` field:
6464
This will generate your new entity class::
6565

6666
// src/Entity/Category.php
67+
namespace App\Entity;
68+
6769
// ...
6870

6971
class Category
@@ -99,7 +101,7 @@ the ``ManyToOne`` annotation. You can do this by hand, or by using the ``make:en
99101
command, which will ask you several questions about your relationship. If you're
100102
not sure of the answer, don't worry! You can always change the settings later:
101103

102-
.. code-block:: terminal
104+
.. code-block:: bash
103105
104106
$ php bin/console make:entity
105107
@@ -144,6 +146,7 @@ the ``Product`` entity (and getter & setter methods):
144146
.. code-block:: php-annotations
145147
146148
// src/Entity/Product.php
149+
namespace App\Entity;
147150
148151
// ...
149152
class Product
@@ -214,7 +217,8 @@ class that will hold these objects:
214217
.. code-block:: php-annotations
215218
216219
// src/Entity/Category.php
217-
220+
namespace App\Entity;
221+
218222
// ...
219223
use Doctrine\Common\Collections\ArrayCollection;
220224
use Doctrine\Common\Collections\Collection;
@@ -310,8 +314,10 @@ Saving Related Entities
310314

311315
Now you can see this new code in action! Imagine you're inside a controller::
312316

317+
// src/Controller/ProductController.php
318+
namespace App/Controller;
319+
313320
// ...
314-
315321
use App\Entity\Category;
316322
use App\Entity\Product;
317323
use Symfony\Component\HttpFoundation\Response;

0 commit comments

Comments
 (0)