示例#1
0
 public function starToggle($id)
 {
     if (!is_numeric($id)) {
         throw new Exceptions\InvalidArgumentException("Argument \$id must be type of numeric, '{$id}' given ");
     }
     try {
         $entry = $this->mailboxDao->find($id);
         $star = $entry->getStarred();
         $entry->setStarred(!$star);
         $this->entityManager->flush();
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
示例#2
0
 public function getTaxSeason(Season $s, SportGroup $sg)
 {
     try {
         $id = "{$this->getEntityClassName()}\\{$s->getId()}-{$sg->getId()}";
         $cache = $this->getEntityCache();
         $data = $cache->load($id);
         if (empty($data)) {
             $data = $this->taxDao->createQueryBuilder("t")->where("t.season = :season")->setParameter("season", $s->getId())->andWhere("t.sportGroup = :group")->setParameter("group", $sg->getId())->getQuery()->getSingleResult();
             $opts = [Cache::TAGS => [self::ENTITY_COLLECTION, $id]];
             $cache->save($id, $data, $opts);
         }
         return $data;
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }