File tree Expand file tree Collapse file tree 5 files changed +6
-10
lines changed Expand file tree Collapse file tree 5 files changed +6
-10
lines changed Original file line number Diff line number Diff 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 * )
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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
391387Now, you can use this method in your controller to query for a ``Product ``
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments