コード例 #1
0
 /**
  * @param Application $application to be saved
  *
  * @throws \Exception
  */
 public function saveApplication(Application $application)
 {
     $data = ['name' => $application->getName(), 'tag' => $application->getTag(), 'email' => $application->getEmail(), 'strategies' => $application->getStrategies(), 'th' => $application->getTh(), 'warStars' => $application->getWarStars(), 'age' => $application->getAge(), 'infos' => $application->getInfos(), 'why' => $application->getWhy(), 'niceAndTidy' => $application->getNiceAndTidy(), 'spoilsOfWar' => $application->getSpoilsOfWar(), 'goldGrab' => $application->getGoldGrab(), 'basepic' => $application->getBasepic(), 'profilepic' => $application->getProfilepic(), 'processed' => $application->getProcessed(), 'processed_by' => $application->getProcessedBy(), 'date_applied' => $application->getDateApplied(), 'mails_send' => $application->getMailsSend()];
     $id = (int) $application->getId();
     if ($id == 0) {
         $this->tableGateway->insert($data);
     } else {
         if ($this->getApplication($id)) {
             $this->tableGateway->update($data, ['id' => $id]);
         } else {
             throw new \Exception('Application id does not exist');
         }
     }
 }