public function enableAction() { $request = $this->getRequest(); $itemId = $request->getParam('id'); if (is_null($itemId)) { $this->_redirector->gotoRouteAndExit(array('module' => 'admin', 'controller' => 'pipeline-property', 'action' => 'index'), 'adminEdit', true); } $pipelinePropertyMapper = new Pipeline_Model_Mapper_PipelineProperty(); $pipelineProperty = $pipelinePropertyMapper->find($itemId, new Pipeline_Model_PipelineProperty()); if (is_null($pipelineProperty)) { throw new Zend_Controller_Action_Exception("Страница не найдена", 404); } $active = $pipelineProperty->getActive() != 0 ? 0 : 1; $pipelineProperty->setActive($active); $pipelinePropertyMapper->save($pipelineProperty); $this->_redirector->gotoRouteAndExit(array('module' => 'admin', 'controller' => 'pipeline-property', 'action' => 'index'), 'adminEdit', true); }
/** * @return null|Pipeline_Model_PipelineProperty * */ protected function _createNewProperty($propertyName) { $pipelinePropertyMapper = new Pipeline_Model_Mapper_PipelineProperty(); $pipelineProperty = new Pipeline_Model_PipelineProperty(); $systemName = $this->_getSistemNameProperty($propertyName); $pipelineProperty->setOptions(array('name' => $propertyName, 'sistemName' => strtolower($systemName), 'active' => 1, 'showList' => 1, 'type' => 0, 'sorting' => 0, 'deleted' => 0)); $pipelinePropertyMapper->save($pipelineProperty); $newProperty = $pipelinePropertyMapper->findBySistemName($pipelineProperty->getSistemName(), new Pipeline_Model_PipelineProperty()); return $newProperty; }