فهرست منبع

simplify sample code

the getSubject() method does pretty much what is shown in the example.
Grégoire Paris 10 سال پیش
والد
کامیت
919a090473
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));