public function indexAction() { $itemId = 1; $this->view->pipelineId = $itemId; $pipelineMapper = new Pipeline_Model_Mapper_Pipeline(); $pipelineProperties = $pipelineMapper->fetchPropertyRel($itemId); if (!empty($pipelineProperties)) { $propertyValuesMapper = new Pipeline_Model_Mapper_PipelinePropertyValues(); $viewProperties = array(); foreach ($pipelineProperties as $property) { $propertyValues = $propertyValuesMapper->findByKey($itemId, $property->getId(), new Pipeline_Model_PipelinePropertyValues()); $viewProperties[$property->getName()] = $propertyValues; } $this->view->properties = $viewProperties; } $propertyArray = $this->_getPropertyArray($itemId); if (0 != count($propertyArray)) { $formValue = new Admin_Form_PipelinePropertyValue(); $formValue->setDefaults(array('pipelineId' => $itemId, 'propertyId' => 0, 'sorting' => 0)); $formValue->getElement('propertyId')->setMultiOptions($propertyArray); $this->view->formValue = $formValue; } }
/** * @return $this */ public function setViewPipelineProperties() { $itemId = $this->_request->getParam('id'); $propertyMapper = new Pipeline_Model_Mapper_PipelineProperty(); $select = $propertyMapper->getDbTable()->select(); $select->where('active != ?', 0)->where('deleted != ?', 1)->order('sorting ASC'); $pipelineProperties = $this->_modelMapper->fetchPropertyRel($itemId, $select); if (!empty($pipelineProperties)) { $propertyValuesMapper = new Pipeline_Model_Mapper_PipelinePropertyValues(); $viewProperties = array(); /**@var $property Pipeline_Model_PipelineProperty*/ foreach ($pipelineProperties as $property) { $propertyValues = $propertyValuesMapper->findByKey($itemId, $property->getId(), new Pipeline_Model_PipelinePropertyValues()); $viewProperties[$property->getName()] = $propertyValues; } $this->view->properties = $viewProperties; } $propertyArray = $this->_getPropertyArray($itemId); if (0 != count($propertyArray)) { $formValue = new Admin_Form_PipelinePropertyValue(); $formValue->setDefaults(array('pipelineId' => $itemId, 'propertyId' => 0, 'sorting' => 0)); $formValue->getElement('propertyId')->setMultiOptions($propertyArray); $this->view->formValue = $formValue; } return $this; }