Story check are done even if there is no story

This commit is contained in:
Nicolas Le Goff
2012-02-10 15:09:05 +01:00
parent d311bb8050
commit 510cdb193a

View File

@@ -62,22 +62,25 @@ class StoryWZRepository extends EntityRepository
public function findUserStory(\User_Adapter $user, \record_adapter $Story)
{
$story = $this->findOneBy(
array(
'usr_id' => $user->get_id(),
'sbas_id' => $Story->get_sbas_id(),
'record_id' => $Story->get_record_id(),
)
array(
'usr_id' => $user->get_id(),
'sbas_id' => $Story->get_sbas_id(),
'record_id' => $Story->get_record_id(),
)
);
try
if ($story)
{
$record = $story->getRecord();
}
catch (\Exception_Record_AdapterNotFound $e)
{
$this->getEntityManager()->remove($story);
$this->getEntityManager()->flush();
$story = null;
try
{
$record = $story->getRecord();
}
catch (\Exception_Record_AdapterNotFound $e)
{
$this->getEntityManager()->remove($story);
$this->getEntityManager()->flush();
$story = null;
}
}
return $story;