Browse Source

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 years ago
parent
commit
ac362829e9
1 changed files with 3 additions and 2 deletions
  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);