コード例 #1
0
 protected function buildFrom() {
     $this->_selectBuilder->from->add(Pap_Db_Table_BannersInRotators::getName());
     $condition = Pap_Db_Table_BannersInRotators::getName().".".Pap_Db_Table_BannersInRotators::ROTATED_BANNER_ID." = ".Pap_Db_Table_Banners::getName().".".Pap_Db_Table_Banners::ID;
     $this->_selectBuilder->from->addInnerJoin(Pap_Db_Table_Banners::getName(), '', $condition);
 }
コード例 #2
0
 function init() {
     $this->setTable(Pap_Db_Table_BannersInRotators::getInstance());
     parent::init();
 }
コード例 #3
0
    function createUpdateIncrementBuild(Pap_Common_Banner $childBanner, $column){
        $updateBuild = new Gpf_SqlBuilder_UpdateBuilder();
        $updateBuild->from->add(Pap_Db_Table_BannersInRotators::getName());
        $updateBuild->set->add($column, "$column+1", false);
        $updateBuild->where->add(Pap_Db_Table_BannersInRotators::PARENT_BANNER_ID,'=',$this->getId());
        $updateBuild->where->add(Pap_Db_Table_BannersInRotators::ROTATED_BANNER_ID,'=',$childBanner->getId());

        $c1 = new Gpf_SqlBuilder_CompoundWhereCondition();
        $c1->add(Pap_Db_Table_BannersInRotators::VALID_FROM,'=',null);
        $c1->add(Pap_Db_Table_BannersInRotators::VALID_UNTIL,'=',null);

        $c2 = new Gpf_SqlBuilder_CompoundWhereCondition();
        $c2->add(Pap_Db_Table_BannersInRotators::VALID_FROM,'<',date("Y-m-d H:i:s"));
        $c2->add(Pap_Db_Table_BannersInRotators::VALID_UNTIL,'>',date("Y-m-d H:i:s"));

        $c3 = new Gpf_SqlBuilder_CompoundWhereCondition();
        $c3->add(Pap_Db_Table_BannersInRotators::VALID_FROM,'=',null);
        $c3->add(Pap_Db_Table_BannersInRotators::VALID_UNTIL,'>',date("Y-m-d H:i:s"));

        $c4 = new Gpf_SqlBuilder_CompoundWhereCondition();
        $c4->add(Pap_Db_Table_BannersInRotators::VALID_FROM,'<',date("Y-m-d H:i:s"));
        $c4->add(Pap_Db_Table_BannersInRotators::VALID_UNTIL,'=',null);

        $c = new Gpf_SqlBuilder_CompoundWhereCondition();
        $c->addCondition($c1,'OR');
        $c->addCondition($c2,'OR');
        $c->addCondition($c3,'OR');
        $c->addCondition($c4,'OR');

        $updateBuild->where->addCondition($c,'AND');

        return $updateBuild;
    }
コード例 #4
0
 public static function getInstance() {
     if(self::$instance === null) {
         self::$instance = new self;
     }
     return self::$instance;
 }