/**
     * @throws Gpf_DbEngine_TooManyRowsException
     * @throws Gpf_DbEngine_NoRowException
     * @param string $categoryId
     * @return Gpf_Data_Record
     */
    private function getCategoryData($categoryId) {
        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();

        $selectBuilder->select->add(Pap_Db_Table_BannersCategories::DESCRIPTION, Pap_Db_Table_BannersCategories::DESCRIPTION, 'c');
        $selectBuilder->select->add(Pap_Db_Table_BannersCategories::CATEGORYID, Pap_Db_Table_BannersCategories::CATEGORYID, 'c');
        $selectBuilder->select->add(Gpf_Db_Table_HierarchicalDataNodes::NAME, Gpf_Db_Table_HierarchicalDataNodes::NAME, 'h');
        $selectBuilder->select->add(Gpf_Db_Table_HierarchicalDataNodes::STATE, 'visible', 'h');

        $selectBuilder->from->add(Gpf_Db_Table_HierarchicalDataNodes::getName(), "h");
        $selectBuilder->from->addLeftJoin(Pap_Db_Table_BannersCategories::getName(), "c",
            "h.".Gpf_Db_Table_HierarchicalDataNodes::CODE." = c.".Pap_Db_Table_BannersCategories::CATEGORYID);

        $selectBuilder->where->add(Gpf_Db_Table_HierarchicalDataNodes::TYPE, '=', Pap_Features_BannersCategories_Main::BANNERS_CATEGORIES_HIERARCHICAL_DATE_TYPE);
        $selectBuilder->where->add(Pap_Db_Table_BannersCategories::CATEGORYID,'=',$categoryId);

        $row = $selectBuilder->getOneRow();
        	
        return $row;
    }
 protected function buildFrom(){
     $this->_selectBuilder->from->add(Gpf_Db_Table_HierarchicalDataNodes::getName(), 'p');
     $this->_selectBuilder->from->add(Gpf_Db_Table_HierarchicalDataNodes::getName(), 'ni');
     $this->_selectBuilder->from->addLeftJoin(Pap_Db_Table_BannersInCategory::getName(), 'c', 'c.'.Pap_Db_Table_BannersInCategory::CATEGORYID.' = ni.'.Gpf_Db_Table_HierarchicalDataNodes::CODE);
 }
 protected function buildFrom(){
     $this->_selectBuilder->from->add(Gpf_Db_Table_HierarchicalDataNodes::getName(), 'p');
     $this->_selectBuilder->from->add(Gpf_Db_Table_HierarchicalDataNodes::getName(), 'ni');
 }
 protected function buildFrom(){
     $this->_selectBuilder->from->add(Gpf_Db_Table_HierarchicalDataNodes::getName(), 'p');
     $this->_selectBuilder->from->add(Gpf_Db_Table_HierarchicalDataNodes::getName(), 'ni');
     $this->_selectBuilder->from->addLeftJoin(Pap_Db_Table_CampaignsInCategory::getName(), 'c', 'c.categoryid = ni.code');
 }
Exemple #5
0
 public function getPath($code)
 {
     //TODO make test
     $select = new Gpf_SqlBuilder_SelectBuilder();
     $select->select->add('p.' . Gpf_Db_Table_HierarchicalDataNodes::NAME);
     $select->select->add('p.' . Gpf_Db_Table_HierarchicalDataNodes::CODE);
     $select->from->add(Gpf_Db_Table_HierarchicalDataNodes::getName(), 'n');
     $select->from->add(Gpf_Db_Table_HierarchicalDataNodes::getName(), 'p');
     $select->where->add('n.' . Gpf_Db_Table_HierarchicalDataNodes::LFT, 'BETWEEN', 'p.' . Gpf_Db_Table_HierarchicalDataNodes::LFT . ' AND p.' . Gpf_Db_Table_HierarchicalDataNodes::RGT, 'AND', false);
     $select->where->add('n.' . Gpf_Db_Table_HierarchicalDataNodes::TYPE, '=', $this->type);
     $select->where->add('p.' . Gpf_Db_Table_HierarchicalDataNodes::TYPE, '=', $this->type);
     $select->where->add('n.' . Gpf_Db_Table_HierarchicalDataNodes::CODE, '=', $code);
     $select->orderBy->add('p.' . Gpf_Db_Table_HierarchicalDataNodes::LFT);
     return $select->getAllRows();
 }