فهرست منبع

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();
         $helper     = $this->getAdminHelper();
         $code       = $this->get('request')->get('code');
         $code       = $this->get('request')->get('code');
         $elementId  = $this->get('request')->get('elementId');
         $elementId  = $this->get('request')->get('elementId');
+        $objectId   = $this->get('request')->get('objectId');
         $admin      = $helper->getAdmin($code);
         $admin      = $helper->getAdmin($code);
 
 
-        $subject = $admin->getModelManager()->findOne($admin->getClass(), $elementId);
+        $subject = $admin->getModelManager()->findOne($admin->getClass(), $objectId);
         if (!$subject) {
         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);
         $formBuilder = $admin->getFormBuilder($subject);