Exemplo n.º 1
0
    /**
     * @param $user_ids
     * @return array
     */
    public function getUsersInfo(array $user_ids)
    {
        if (empty($user_ids)) {
            return array();
        }
        $sql = <<<SQL
SELECT * FROM {@auth_table} AS a LEFT JOIN {@profile_table} AS p ON a.`id` = p.`id` WHERE a.`id` in :id
SQL;
        $auth_table = UserAuthModel::getTableName();
        $profile_table = UserProfileModel::getTableName();
        $sql = strtr($sql, array('{@auth_table}' => $auth_table, '{@profile_table}' => $profile_table));
        $query = $this->getSelectQuery($sql, array(':id' => '(' . implode(',', $user_ids) . ')'));
        $data = $query->getResult();
        $return = array();
        foreach ($data as $row) {
            $return[$row['id']] = $row;
        }
        return $return;
    }