Exemplo n.º 1
0
 public function __construct(EntityManager $em, Logger $logger)
 {
     parent::__construct($em, SportGroup::getClassName(), $logger);
     $this->groupDao = $em->getDao(SportGroup::getClassName());
     $this->sportTypeDao = $em->getDao(SportType::getClassName());
 }
Exemplo n.º 2
0
 public function updateSportType(ArrayHash $values)
 {
     $type = new SportType();
     $type->fromArray((array) $values);
     try {
         $this->sportTypeService->updateSportType($type);
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataSave($values->id, "this", $ex);
     }
     $this->redirect("default");
 }
Exemplo n.º 3
0
 public function updateSportType(SportType $type)
 {
     if ($type === null) {
         throw new Exceptions\NullPointerException("Argument SportType cannot be null");
     }
     try {
         $dbType = $this->sportTypeDao->find($type->getId());
         if ($dbType !== null) {
             $dbType->fromArray($type->toArray());
             $this->entityManager->merge($dbType);
             $this->entityManager->flush();
             $this->invalidateEntityCache($dbType);
             $this->onUpdate(clone $dbType);
         }
     } catch (DuplicateEntryException $ex) {
         $this->logWarning($ex->getMessage());
         throw new Exceptions\DuplicateEntryException($ex);
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }