コード例 #1
0
ファイル: Funds.php プロジェクト: digvijaymohite/e-tender
 function saveFund()
 {
     $response = new Response();
     try {
         $id = $this->input->post("scheme-id");
         $name = $this->input->post("fund-name");
         $amount = $this->input->post("fund-amt");
         $scheme = $this->findById("Scheme", $id);
         if ($scheme == null) {
             throw new RuntimeException("Invalid Request..!");
         }
         $fund = new Fund();
         $fund->setScheme($scheme);
         $fund->setCreated(new DateTime());
         $fund->setUsedAmount(0);
         $fund->setName($name);
         $fund->setAmount($amount);
         $this->save($fund);
     } catch (Exception $e) {
         $response->setStatus(false);
         $response->setErrorMessage($e->getMessage());
     }
     $this->output->set_content_type('application/json')->set_output(json_encode($response));
 }