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

Take builder out from $this->builder()->select() in GroupModel.php #11

Closed
fefo-p opened this issue Aug 23, 2018 · 2 comments
Closed

Take builder out from $this->builder()->select() in GroupModel.php #11

fefo-p opened this issue Aug 23, 2018 · 2 comments

Comments

@fefo-p
Copy link
Contributor

fefo-p commented Aug 23, 2018

return $this->builder()->select('auth_groups_users.*, auth_groups.name, auth_groups.description')

In the last commit, you changed the line (along with namespacing issues)

return $this->select('auth_groups_users.*, auth_groups.name, auth_groups.description') 

to

return $this->builder()->select('auth_groups_users.*, auth_groups.name, auth_groups.description') 

Now it complains about not finding toArray() method.
I took ->builder() out from the statement and it started working again.

@fefo-p
Copy link
Contributor Author

fefo-p commented Aug 23, 2018

Taking a closer look, in PermissionModel you are using builder(), though I haven't tried it yet so I don't know if we'll run into the same problem.

    public function doesUserHavePermission(int $userId, int $permissionId): bool
    {
        $permissions = $this->builder()
            ->join('auth_groups_permissions', 'auth_groups_permissions.permission_id = auth_permissions.id', 'inner')
            ->join('auth_groups_users', 'auth_groups_users.group_id = auth_groups_permissions.group_id', 'inner')
            ->where('auth_groups_users.user_id', $userId)
            ->asArray()
            ->findAll();

@fefo-p
Copy link
Contributor Author

fefo-p commented Aug 24, 2018

Already in a pull request

@fefo-p fefo-p closed this as completed Aug 24, 2018
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

1 participant