public function updateSeasonApplication(SeasonApplication $app) { if ($app === null) { throw new Exceptions\NullPointerException("Argument SeasonApplication cannot be null", 0); } try { $this->entityManager->beginTransaction(); $appDb = $this->seasonApplicationDao->find($app->getId(), false); if ($appDb !== null) { $app->setEnrolledTime($appDb->getEnrolledTime()); $appDb->fromArray($app->toArray()); $this->applicationSeasonTypeHandle($appDb); $this->applicationPaymentTypeHandle($appDb); $this->applicationGroupTypeHandle($appDb); $this->applicationOwnerTypeHandle($appDb); $this->applicationEditorTypeHandle($appDb); $appDb->setUpdated(new DateTime()); $this->entityManager->merge($appDb); $this->entityManager->flush(); } $this->entityManager->commit(); $this->invalidateEntityCache($appDb); $this->onUpdate(clone $appDb); } catch (DuplicateEntryException $ex) { $this->logWarning($ex); throw new Exceptions\DuplicateEntryException($ex->getMessage(), Exceptions\DuplicateEntryException::SEASON_APPLICATION, $ex->getPrevious()); } catch (\Exception $ex) { $this->logError($ex->getMessage()); throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious()); } }