示例#1
0
 public function createAction()
 {
     $serverCreateForm = new Application_Form_ServerCreate(array('serverTypes' => $this->_getAllServerTypesAsArray()));
     /** @var $request Zend_Controller_Request_Http */
     $request = $this->getRequest();
     if ($request->isPost() && $serverCreateForm->isValid($request->getPost())) {
         $serverModel = new Application_Model_Server();
         $serverModel->setFromArray($serverCreateForm->getValues());
         $this->_getServerMapper()->save($serverModel);
         $this->getFlashMessenger()->addSuccessMessage(sprintf('successfully added server with id %d', $serverModel->getId()));
         $this->_redirect($this->url('index'), array('exit' => true));
     }
     $this->view->assign('form', $serverCreateForm);
 }
示例#2
0
 public function isValid($data)
 {
     $data['server_type_id'] = $this->_model->getServerTypeId();
     return parent::isValid($data);
 }