partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 477646ea380f25bdf92d6b33031f90ed9bf05a83
parent f91ee1fa14d510828c377175fdd9ae445fc6cc83
Author: Felicitus <felicitus@felicitus.org>
Date:   Wed,  7 Sep 2011 05:06:41 +0200

Don't bail out if the same tip gets read twice

Diffstat:
Msrc/de/RaumZeitLabor/PartKeepr/TipOfTheDay/TipOfTheDayService.php | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/de/RaumZeitLabor/PartKeepr/TipOfTheDay/TipOfTheDayService.php b/src/de/RaumZeitLabor/PartKeepr/TipOfTheDay/TipOfTheDayService.php @@ -65,12 +65,17 @@ class TipOfTheDayService extends Service implements RestfulService { public function markTipAsRead () { $this->requireParameter("name"); - $th = new TipOfTheDayHistory; - $th->setUser($this->getUser()); - $th->setName($this->getParameter("name")); + try { + $th = new TipOfTheDayHistory; + $th->setUser($this->getUser()); + $th->setName($this->getParameter("name")); + + PartKeepr::getEM()->persist($th); + PartKeepr::getEM()->flush(); + } catch (\Exception $e) { + /* Do nothing */ + } - PartKeepr::getEM()->persist($th); - PartKeepr::getEM()->flush(); } /**