Преглед изворни кода

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);