/**
  * @return void
  */
 public function editExtendAction()
 {
     $form = $this->getLocator()->get('ZlySysmap\\Form\\Extend');
     $params = $this->getRequest()->getMetadata();
     $form->populate($params);
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->post()->toArray())) {
             try {
                 $this->model->saveExtension($form->getValues());
                 return $this->redirect(array())->toRoute('default', array('controller' => 'sysmap-admin', 'action' => 'list'));
             } catch (\Exception $e) {
                 $form->setErrors(array($e->getMessage()));
             }
         }
     } else {
         $hash = $this->getRequest()->getMetadata('hash');
         if (!empty($hash)) {
             $values = $this->model->getNodeByHash($hash);
             if ($values instanceof Model\Mapper\Extend) {
                 $values = $values->toArray();
             }
             if ($values->params instanceof \Zend\Config\Config) {
                 $values->params = $values->params->toArray();
             }
             if (!empty($values)) {
                 $values->sysmap_id = $this->model->getParentByHash($hash)->hash;
                 $form->populate((array) $values);
             }
         }
     }
     return array('editExtensionForm' => $form);
 }