File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -665,7 +665,9 @@ the relationship between the removed ``Tag`` and ``Task`` object.
665
665
is handling the "update" of your Task::
666
666
667
667
// src/Acme/TaskBundle/Controller/TaskController.php
668
-
668
+
669
+ use Doctrine\Common\Collections\ArrayCollection;
670
+
669
671
// ...
670
672
public function editAction($id, Request $request)
671
673
{
@@ -676,7 +678,7 @@ the relationship between the removed ``Tag`` and ``Task`` object.
676
678
throw $this->createNotFoundException('No task found for is '.$id);
677
679
}
678
680
679
- $originalTags = new \Doctrine\Common\Collections\ ArrayCollection();
681
+ $originalTags = new ArrayCollection();
680
682
681
683
// Create an ArrayCollection of the current Tag objects in the database
682
684
foreach ($task->getTags() as $tag) {
@@ -691,11 +693,11 @@ the relationship between the removed ``Tag`` and ``Task`` object.
691
693
692
694
// remove the relationship between the tag and the Task
693
695
foreach ($originalTags as $tag) {
694
- if ($task->getTags()->contains($tag) == false ) {
696
+ if (false === $task->getTags()->contains($tag)) {
695
697
// remove the Task from the Tag
696
698
$tag->getTasks()->removeElement($task);
697
699
698
- // if it were a ManyToOne relationship, remove the relationship like this
700
+ // if it was a ManyToOne relationship, remove the relationship like this
699
701
// $tag->setTask(null);
700
702
701
703
$em->persist($tag);
You can’t perform that action at this time.
0 commit comments