Bläddra i källkod

Fixing problem when id is not set in find. This also resolve problem with master-detail forms when master has not been persisted. -https://github.com/sonata-project/SonataAdminBundle/issues/259-

Christian Torres 13 år sedan
förälder
incheckning
6e19b3be40
1 ändrade filer med 4 tillägg och 0 borttagningar
  1. 4 0
      Model/ModelManager.php

+ 4 - 0
Model/ModelManager.php

@@ -138,6 +138,10 @@ class ModelManager implements ModelManagerInterface
      */
     public function find($class, $id)
     {
+        if ( !isset($id) ) {
+            return null;
+        }
+
         $values = array_combine($this->getIdentifierFieldNames($class), explode(self::ID_SEPARATOR, $id));
         return $this->getEntityManager($class)->getRepository($class)->find($values);
     }