瀏覽代碼

This commit fixes an issue when adding new relationships via the ajax dialog

Due to a typing mistake (I believe) the ajax call to get the updated form dropdown fails
because it attempts to find the database record with the html input id (elementId) instead of
the objects id (objectId).
CodingNinja 14 年之前
父節點
當前提交
ac362829e9
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      Controller/HelperController.php

+ 3 - 2
Controller/HelperController.php

@@ -60,11 +60,12 @@ class HelperController extends Controller
         $helper     = $this->getAdminHelper();
         $code       = $this->get('request')->get('code');
         $elementId  = $this->get('request')->get('elementId');
+        $objectId   = $this->get('request')->get('objectId');
         $admin      = $helper->getAdmin($code);
 
-        $subject = $admin->getModelManager()->findOne($admin->getClass(), $elementId);
+        $subject = $admin->getModelManager()->findOne($admin->getClass(), $objectId);
         if (!$subject) {
-            throw new NotFoundHttpException(sprintf('Unable to find the object id: %s, class: %s', $admin->getClass(), $elementId));
+            throw new NotFoundHttpException(sprintf('Unable to find the object id: %s, class: %s', $objectId, $admin->getClass()));
         }
 
         $formBuilder = $admin->getFormBuilder($subject);