Explorar o código

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 %!s(int64=14) %!d(string=hai) anos
pai
achega
ac362829e9
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  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);