浏览代码

simplify sample code

the getSubject() method does pretty much what is shown in the example.
Grégoire Paris 10 年之前
父节点
当前提交
923b13ccb2
共有 1 个文件被更改,包括 1 次插入3 次删除
  1. 1 3
      Resources/doc/cookbook/recipe_custom_action.rst

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

@@ -100,9 +100,7 @@ to implement a ``clone`` action.
     {
         public function cloneAction()
         {
-            $id = $this->get('request')->get($this->admin->getIdParameter());
-
-            $object = $this->admin->getObject($id);
+            $object = $this->admin->getSubject();
 
             if (!$object) {
                 throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));