Browse Source

Update recipe_custom_action.rst

Hugo Briand 11 years ago
parent
commit
d89d9dc144
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Resources/doc/cookbook/recipe_custom_action.rst

+ 2 - 1
Resources/doc/cookbook/recipe_custom_action.rst

@@ -108,7 +108,8 @@ to implement a ``clone`` action.
                 throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
             }
 
-            $clonedObject = clone $object;
+            $clonedObject = clone $object;  // Careful, you may need to overload the __clone method of your object
+                                            // to set its id to null
             $clonedObject->setName($object->getName()." (Clone)");
 
             $this->admin->create($clonedObject);