protected function _getPropertyArray()
 {
     $pipelinePropertyMapper = new Pipeline_Model_Mapper_PipelineProperty();
     $select = $pipelinePropertyMapper->getDbTable()->select();
     $select->where('deleted != ?', 1)->where('active != ?', 0)->order('sorting ASC');
     $pipelinePropertyArray = array();
     $pipelinePropertyArray[] = '...';
     $pipelineProperty = $pipelinePropertyMapper->fetchAll($select);
     if (!empty($pipelineProperty)) {
         foreach ($pipelineProperty as $property) {
             $pipelinePropertyArray[$property->getId()] = $property->getName();
         }
     }
     return $pipelinePropertyArray;
 }
 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);
 }
 /**
  * @param $itemId
  * @return array
  *
  */
 protected function _getPropertyArray($itemId)
 {
     $pipelinePropertyMapper = new Pipeline_Model_Mapper_PipelineProperty();
     $select = $pipelinePropertyMapper->getDbTable()->select();
     $select->where('deleted != ?', 1)->where('active != ?', 0)->order('sorting ASC');
     $pipelinePropertyArray = array();
     $pipelinePropertyArray[] = '...';
     $pipelineProperty = $pipelinePropertyMapper->fetchAll($select);
     $pipelinePropertyValuesMapper = new Pipeline_Model_Mapper_PipelinePropertyValues();
     $select = $pipelinePropertyValuesMapper->getDbTable()->select();
     $select->where('pipeline_id = ?', $itemId);
     $pipelinePropertyValuesArray = $pipelinePropertyValuesMapper->fetchAll($select);
     $itemIdArray = array();
     if (!empty($pipelinePropertyValuesArray)) {
         foreach ($pipelinePropertyValuesArray as $pipelinePropertyValue) {
             $itemIdArray[] = $pipelinePropertyValue->getPropertyId();
         }
     }
     if (!empty($pipelineProperty)) {
         foreach ($pipelineProperty as $property) {
             if (!in_array($property->getId(), $itemIdArray)) {
                 $pipelinePropertyArray[$property->getId()] = $property->getName();
             }
         }
     }
     $pipelinePropertyArray['new'] = 'Новое';
     return $pipelinePropertyArray;
 }
 /**
  * @param $id
  * @param Zend_Db_Table_Select|null $select
  * @return Pipeline_Model_Pipeline[]|null
  */
 public function fetchPropertyRel($id, Zend_Db_Table_Select $select = null)
 {
     $result = $this->getDbTable()->find($id);
     if (0 == count($result)) {
         return null;
     }
     $item = $result->current();
     $resultSet = $item->findManyToManyRowset("Pipeline_Model_DbTable_PipelineProperty", "Pipeline_Model_DbTable_PipelinePropertyValues", null, null, $select);
     $entries = array();
     $property = new Pipeline_Model_Mapper_PipelineProperty();
     foreach ($resultSet as $row) {
         $entry = new Pipeline_Model_PipelineProperty();
         $entry = $property->_setDbData($row, $entry);
         $entries[] = $entry;
     }
     return $entries;
 }
 public function testAction()
 {
     $sistemName = 'test4';
     $pipelinePropertyMapper = new Pipeline_Model_Mapper_PipelineProperty();
     $property = $pipelinePropertyMapper->findBySistemName($sistemName, new Pipeline_Model_PipelineProperty());
     var_dump($property->getId());
 }
 function getPropertyPipeline($property_id)
 {
     $pipelineMapper = new Pipeline_Model_Mapper_PipelineProperty();
     $property = $pipelineMapper->find($property_id, new Pipeline_Model_PipelineProperty());
     return $property;
 }