소스 검색

CRUDController::editAction now respects $id param (#3961)

Niels Keurentjes 9 년 전
부모
커밋
be82d59407
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      Controller/CRUDController.php

+ 2 - 2
Controller/CRUDController.php

@@ -221,7 +221,7 @@ class CRUDController extends Controller
     /**
      * Edit action.
      *
-     * @param int|string|null $id
+     * @param int|string|null $id Optional ID to use instead of globally provided default.
      *
      * @return Response|RedirectResponse
      *
@@ -234,7 +234,7 @@ class CRUDController extends Controller
         // the key used to lookup the template
         $templateKey = 'edit';
 
-        $id = $request->get($this->admin->getIdParameter());
+        $id = $id ?: $request->get($this->admin->getIdParameter());
         $object = $this->admin->getObject($id);
 
         if (!$object) {