瀏覽代碼

Update recipe_custom_action.rst

Hugo Briand 11 年之前
父節點
當前提交
d89d9dc144
共有 1 個文件被更改,包括 2 次插入1 次删除
  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);