setName() 공개 메소드

public setName ( string $name )
$name string
예제 #1
0
 public function addAction()
 {
     $success = false;
     $report = CustomReport\Config::getByName($this->getParam("name"));
     if (!$report) {
         $report = new CustomReport\Config();
         $report->setName($this->getParam("name"));
         $report->save();
         $success = true;
     }
     $this->_helper->json(["success" => $success, "id" => $report->getName()]);
 }
 public function addAction()
 {
     try {
         CustomReport\Config::getByName($this->getParam("name"));
         $alreadyExist = true;
     } catch (\Exception $e) {
         $alreadyExist = false;
     }
     if (!$alreadyExist) {
         $report = new CustomReport\Config();
         $report->setName($this->getParam("name"));
         $report->save();
     }
     $this->_helper->json(array("success" => !$alreadyExist, "id" => $report->getName()));
 }