public function updateSeasonTaxHandle(ArrayHash $values) { $tax = new SeasonTax((array) $values); try { $tax->setEditor($this->getUser()->getIdentity()); $this->getSeasonTaxService()->updateSeasonTax($tax); } catch (Exceptions\DataErrorException $ex) { $this->handleDataSave($values->id, "this", $ex); } $this->redirect("default"); }
public function updateSeasonTax(SeasonTax $t) { if ($t == null) { throw new Exceptions\NullPointerException("Argument SeasonTax cannot be null", 0); } try { $this->entityManager->beginTransaction(); $tDb = $this->seasonTaxDao->find($t->getId()); if ($tDb !== null) { $tDb->fromArray($t->toArray()); $this->taxSeasonTypeHandle($tDb); $this->taxSportGroupTypeHandle($tDb); $this->taxEditorTypeHandle($tDb); $tDb->setChanged(new DateTime()); $this->entityManager->merge($tDb); $this->entityManager->flush(); } $this->entityManager->commit(); $this->invalidateEntityCache($t); $this->onUpdate($t); } catch (DuplicateEntryException $ex) { $this->logWarning($ex); throw new Exceptions\DuplicateEntryException($ex->getMessage(), Exceptions\DuplicateEntryException::SEASON_TAX, $ex->getPrevious()); } catch (\Exception $ex) { $this->logError($ex->getMessage()); throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious()); } }