Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findAll itertation is not working in PHP API #208

Closed
vzeman opened this issue Oct 9, 2015 · 2 comments
Closed

findAll itertation is not working in PHP API #208

vzeman opened this issue Oct 9, 2015 · 2 comments

Comments

@vzeman
Copy link

vzeman commented Oct 9, 2015

I have discovered, that parameters set to function findAll were not passed to the API call

current function

    /**
     * List all users
     *
     * @param array $params
     *
     * @throws ResponseException
     * @throws \Exception
     * @return mixed
     */
    public function findAll(array $params = [])
    {
        if (isset($params['organization_id'])) {
            $this->endpoint = "organizations/{$params['organization_id']}/users.json";
        } elseif (isset($params['group_id'])) {
            $this->endpoint = 'groups/' . $params['group_id'] . '/users.json';
        } else {
            $this->endpoint = 'users.json';
        }

        return $this->traitFindAll();
    }

should be fixed to:

    /**
     * List all users
     *
     * @param array $params
     *
     * @throws ResponseException
     * @throws \Exception
     * @return mixed
     */
    public function findAll(array $params = [])
    {
        if (isset($params['organization_id'])) {
            $this->endpoint = "organizations/{$params['organization_id']}/users.json";
        } elseif (isset($params['group_id'])) {
            $this->endpoint = 'groups/' . $params['group_id'] . '/users.json';
        } else {
            $this->endpoint = 'users.json';
        }

        return $this->traitFindAll($params);
    }

The only change is missing parameter $params in the line:
return $this->traitFindAll();

@vzeman
Copy link
Author

vzeman commented Oct 9, 2015

In your current version of PHP API is not working following code:
$users = $client->users()->findAll(array('page'=>2));

It will always return page number 1

@miogalang
Copy link
Contributor

Fixed by #209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants