Skip to content

Commit

Permalink
use custom finder method in line with cake 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
styks1987 committed Oct 22, 2015
1 parent 3f7a696 commit 577207a
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions README.md
Expand Up @@ -136,21 +136,30 @@ if you later want to move your database and the role table happens to start with
ACL roles configuration).

Whichever associations you choose to define, you also have to make sure they get saved in the session when the user logs in
through whichever authentication method you use. Make sure you put them in ``contain`` inside your authentication configuration:
through whichever authentication method you use. You will need to write a custom finder method to ensure the correct data is contained.

```php
$this->loadComponent('Auth', [
'authenticate' => [
'Form' => [
'contain' => [
'Roles',
'Right',
],
'finder'=>'AuthUser'
],
],
]);
```

```php
// In your UsersTable
public function findAuthUser(Query $query, $options)
{
$query->contain([
'Roles',
'Rights'
]);
return $query;
}
```

### Requirements
- PHP >= 5.4.16
- CakePHP >= 3.0
Expand Down

0 comments on commit 577207a

Please sign in to comment.