Skip to content

Commit

Permalink
Fixing problem when id is not set in find. This also resolve problem …
Browse files Browse the repository at this point in the history
…with master-detail forms when master has not been persisted. -sonata-project/SonataAdminBundle#259
  • Loading branch information
chrux committed Apr 11, 2012
1 parent 93298ce commit 6e19b3b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Model/ModelManager.php
Expand Up @@ -138,6 +138,10 @@ public function delete($object)
*/
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);
}
Expand Down

0 comments on commit 6e19b3b

Please sign in to comment.