ソースを参照

Fix model manager method call

Thomas Rabaix 13 年 前
コミット
a85b1ee424

+ 1 - 5
Admin/Admin.php

@@ -1261,15 +1261,11 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
     public function getSubject()
     {
         if ($this->subject === null && $this->request) {
-
             $id = $this->request->get($this->getIdParameter());
             if (!is_numeric($id)) {
                 $this->subject = false;
             } else {
-                $this->subject = $this->getModelManager()->findOne(
-                    $this->getClass(),
-                    $id
-                );
+                $this->subject = $this->getModelManager()->find($this->getClass(), $id);
             }
         }
 

+ 2 - 2
Controller/HelperController.php

@@ -43,7 +43,7 @@ class HelperController extends Controller
             $admin->setUniqid($uniqid);
         }
 
-        $subject = $admin->getModelManager()->findOne($admin->getClass(), $objectId);
+        $subject = $admin->getModelManager()->find($admin->getClass(), $objectId);
         if ($objectId && !$subject) {
             throw new NotFoundHttpException;
         }
@@ -83,7 +83,7 @@ class HelperController extends Controller
         $uniqid     = $this->get('request')->query->get('uniqid');
 
         if ($objectId) {
-            $subject = $admin->getModelManager()->findOne($admin->getClass(), $objectId);
+            $subject = $admin->getModelManager()->find($admin->getClass(), $objectId);
             if (!$subject) {
                 throw new NotFoundHttpException(sprintf('Unable to find the object id: %s, class: %s', $objectId, $admin->getClass()));
             }

+ 2 - 2
Form/ChoiceList/ModelChoiceList.php

@@ -116,7 +116,7 @@ class ModelChoiceList extends ArrayChoiceList
         } else if ($this->query) {
             $entities = $this->modelManager->executeQuery($this->query);
         } else {
-            $entities = $this->modelManager->find($this->class);
+            $entities = $this->modelManager->findBy($this->class);
         }
 
         $this->choices = array();
@@ -207,7 +207,7 @@ class ModelChoiceList extends ArrayChoiceList
 //                return $qb->andWhere($where)->getQuery()->getSingleResult();
 //            }
 
-        return $this->modelManager->findOne($this->class, $key);
+        return $this->modelManager->find($this->class, $key);
     }
 
     /**

+ 1 - 1
Form/DataTransformer/ModelToIdTransformer.php

@@ -50,7 +50,7 @@ class ModelToIdTransformer implements DataTransformerInterface
             return null;
         }
 
-        return $this->modelManager->findOne($this->className, $newId);
+        return $this->modelManager->find($this->className, $newId);
     }
 
     /**