Quellcode durchsuchen

Update recipe_custom_action.rst (#4462)

Fix variable $id not being defined in cloneAction().
Philippe-B- vor 8 Jahren
Ursprung
Commit
bc9a1c64b3
1 geänderte Dateien mit 5 neuen und 2 gelöschten Zeilen
  1. 5 2
      Resources/doc/cookbook/recipe_custom_action.rst

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

@@ -92,7 +92,10 @@ to implement a ``clone`` action.
 
 
     class CRUDController extends Controller
     class CRUDController extends Controller
     {
     {
-        public function cloneAction()
+        /**
+         * @param $id
+         */
+        public function cloneAction($id)
         {
         {
             $object = $this->admin->getSubject();
             $object = $this->admin->getSubject();
 
 
@@ -117,7 +120,7 @@ to implement a ``clone`` action.
         }
         }
     }
     }
 
 
-Here we first get the id of the object, see if it exists then clone it and insert the clone
+Here we first get the object, see if it exists then clone it and insert the clone
 as a new object. Finally we set a flash message indicating success and redirect to the list view.
 as a new object. Finally we set a flash message indicating success and redirect to the list view.
 
 
 If you want to add the current filter parameters to the redirect url you can add them to the `generateUrl` method:
 If you want to add the current filter parameters to the redirect url you can add them to the `generateUrl` method: