protected function buildFrom() { $this->_selectBuilder->from->add(Pap_Db_Table_Users::getName(), 'u'); $this->_selectBuilder->from->addInnerJoin(Gpf_Db_Table_Users::getName(), 'gu', 'u.accountuserid=gu.accountuserid'); $this->_selectBuilder->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), 'au', 'au.authid=gu.authid'); $this->_selectBuilder->from->addInnerJoin(Gpf_Db_Table_Accounts::getName(), 'a', 'a.accountid=gu.accountid'); $this->_selectBuilder->from->addInnerJoin(Gpf_Db_Table_Roles::getName(), 'r', 'r.roleid=gu.roleid'); }
public function loadByRoleType($roleType, $application) { $query = new Gpf_SqlBuilder_SelectBuilder(); $query->select->addAll(Gpf_Db_Table_Users::getInstance(), 'u'); $query->from->add(Gpf_Db_Table_Users::getName(), "u"); $query->from->addInnerJoin(Gpf_Db_Table_Roles::getName(), "r", "r.roleid = u.roleid"); $query->from->addInnerJoin(Gpf_Db_Table_Accounts::getName(), "a", "u.accountid = a.accountid"); $query->where->add('u.authid', '=', $this->getAuthId()); $query->where->add('u.accountid', '=', $this->getAccountId()); $query->where->add('a.application', '=', $application); $query->where->add('r.roletype', '=', $roleType); $record = $query->getOneRow(); $this->fillFromRecord($record); }
/** * Get recordset of merchants recipients * * @param $from * @return Gpf_Data_RecordSet */ private function getMerchantsRecipients($from) { $select = new Gpf_SqlBuilder_SelectBuilder(); $select->select->addAll(Gpf_Db_Table_AuthUsers::getInstance(), 'au'); $select->select->addAll(Gpf_Db_Table_Accounts::getInstance(), 'a'); $select->select->addAll(Gpf_Db_Table_Users::getInstance(), 'gu'); $select->select->addAll(Pap_Db_Table_Users::getInstance(), 'u'); $select->from->add(Pap_Db_Table_Users::getName(), 'u'); $select->from->addInnerJoin(Gpf_Db_Table_Users::getName(), 'gu', 'u.'.Pap_Db_Table_Users::ACCOUNTUSERID.'=gu.'.Gpf_Db_Table_Users::ID. ' AND u.'.Pap_Db_Table_Users::DELETED . ' = \'' . Gpf::NO . '\''. ' AND u.' .Pap_Db_Table_Users::TYPE . ' = \'' . Pap_Application::ROLETYPE_MERCHANT . '\''); $select->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), 'au', 'au.'.Gpf_Db_Table_AuthUsers::ID.'=gu.'.Gpf_Db_Table_Users::AUTHID); $select->from->addInnerJoin(Gpf_Db_Table_Accounts::getName(), 'a', 'a.'.Gpf_Db_Table_Accounts::ID.'=gu.'.Gpf_Db_Table_Users::ACCOUNTID); $select->limit->set($from, Pap_Mail_MassMailAffiliatesGrid::MAX_ROWS_PER_SQL); return $select->getAllRows(); }