/** * Returns an instance of class (singleton pattern implementation). * * @return GROUPS_BOL_InviteDao */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
public function findInvitedUserIdList($groupId, $inviterId) { $list = $this->inviteDao->findListByGroupIdAndInviterId($groupId, $inviterId); $out = array(); foreach ($list as $item) { $out[] = $item->userId; } return $out; }
/** * @param integer $userId * @return integer */ public function findUserInvitedGroupsCount($userId, $newOnly = false) { $addWhere = $newOnly ? 'i.viewed=0' : '1'; $query = "SELECT COUNT(DISTINCT g.id) AS `count` FROM `" . $this->getTableName() . "` AS `g`\n INNER JOIN `" . GROUPS_BOL_InviteDao::getInstance()->getTableName() . "` AS `i` ON ( `g`.`id` = `i`.`groupId` )\n WHERE `i`.`userId` = :u AND " . $addWhere; return $this->dbo->queryForColumn($query, array('u' => (int) $userId)); }