10000 Merge branch '2.8' into 3.4 · symfony/symfony-docs@6bfddac · GitHub
[go: up one dir, main page]

Skip to content

Commit 6bfddac

Browse files
committed
Merge branch '2.8' into 3.4
* 2.8: change targetEntity format Less code Wrong function name
2 parents f380e04 + 01db1c4 commit 6bfddac

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

best_practices/business-logic.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ looking for mapping information::
273273

274274
/**
275275
* @ORM\OneToMany(
276-
* targetEntity="Comment",
276+
* targetEntity="App\Entity\Comment",
277277
* mappedBy="post",
278278
* orphanRemoval=true
279279
* )

controller/upload_file.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ logic to a separate service::
236236
$fileName = md5(uniqid()).'.'.$file->guessExtension();
237237

238238
try {
239-
$file->move($this->getTargetDir(), $fileName);
239+
$file->move($this->getTargetDirectory(), $fileName);
240240
} catch (FileException $e) {
241241
// ... handle exception if something happens during file upload
242242
}

doctrine/associations.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,7 @@ following method to the ``ProductRepository`` class::
381381
WHERE p.id = :id'
382382
)->setParameter('id', $productId);
383383

384-
try {
385-
return $query->getSingleResult();
386-
} catch (\Doctrine\ORM\NoResultException $exception) {
387-
return null;
388-
}
384+
return $query->getOneOrNullResult();
389385
}
390386

391387
Now, you can use this method in your controller to query for a ``Product``

form/form_collections.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ you will learn about next!).
469469
// ...
470470
471471
/**
472-
* @ORM\ManyToMany(targetEntity="Tag", cascade={"persist"})
472+
* @ORM\ManyToMany(targetEntity="App\Entity\Tag", cascade={"persist"})
473473
*/
474474
protected $tags;
475475
@@ -481,7 +481,7 @@ you will learn about next!).
481481
# ...
482482
oneToMany:
483483
tags:
484-
targetEntity: Tag
484+
targetEntity: App\Entity\Tag
485485
cascade: [persist]
486486
487487
.. code-block:: xml

reference/constraints/UniqueEntity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Consider this example:
222222
class Service
223223
{
224224
/**
225-
* @ORM\ManyToOne(targetEntity="Host")
225+
* @ORM\ManyToOne(targetEntity="App\Entity\Host")
226226
*/
227227
public $host;
228228

0 commit comments

Comments
 (0)
0