/** * Edit a subnet's properties * * Query params: subnet, mask * * @return array|\Zend\Http\Response array(subnet, form) or redirect response */ public function propertiesAction() { $params = $this->params(); $subnet = $this->_subnetManager->getSubnet($params->fromQuery('subnet'), $params->fromQuery('mask')); if ($this->getRequest()->isPost()) { $this->_subnetForm->setData($params->fromPost()); if ($this->_subnetForm->isValid()) { $data = $this->_subnetForm->getData(); $this->_subnetManager->saveSubnet($subnet['Address'], $subnet['Mask'], $data['Name']); return $this->redirectToRoute('network', 'index'); } } else { $this->_subnetForm->setData(array('Name' => $subnet['Name'])); } return array('subnet' => $subnet, 'form' => $this->_subnetForm); }