Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit958eb15

Browse files
author
Florian Körner
committed
Simplified "Ensuring the database persistence" example
corrections
1 parentf4306ac commit958eb15

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎cookbook/form/form_collections.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,9 @@ the relationship between the removed ``Tag`` and ``Task`` object.
665665
is handling the "update" of your Task::
666666

667667
// src/Acme/TaskBundle/Controller/TaskController.php
668-
668+
669+
use Doctrine\Common\Collections\ArrayCollection;
670+
669671
// ...
670672
public function editAction($id, Request $request)
671673
{
@@ -676,7 +678,7 @@ the relationship between the removed ``Tag`` and ``Task`` object.
676678
throw $this->createNotFoundException('No task found for is '.$id);
677679
}
678680

679-
$originalTags = new\Doctrine\Common\Collections\ArrayCollection();
681+
$originalTags = new ArrayCollection();
680682

681683
// Create an ArrayCollection of the current Tag objects in the database
682684
foreach ($task->getTags() as $tag) {
@@ -691,11 +693,11 @@ the relationship between the removed ``Tag`` and ``Task`` object.
691693

692694
// remove the relationship between the tag and the Task
693695
foreach ($originalTags as $tag) {
694-
if ($task->getTags()->contains($tag) == false) {
696+
if (false ===$task->getTags()->contains($tag)) {
695697
// remove the Task from the Tag
696698
$tag->getTasks()->removeElement($task);
697699

698-
// if itwere a ManyToOne relationship, remove the relationship like this
700+
// if itwas a ManyToOne relationship, remove the relationship like this
699701
// $tag->setTask(null);
700702

701703
$em->persist($tag);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp