CakePHP3 Auth Question

So I am working with my auth component and it appears to be returning my users table just fine. However my users table has linkings to other tables. When a user logs in how can I pull in the supporting linking table information. For instance in my table the “role” column shows a 1 but in another table 1 is Field Engineer. How do I link them and have all of the data available to me?


You will have to create a custom finder method

in your user table you must add something like this:

public function findAuth(\Cake\ORM\Query $query, array $options)
        ->select(['id', 'username', 'password'])
        ->where(['' => 1])

    return $query;

and add this method to your finder

    'authenticate' => [
        'Form' => [
            'finder' => 'auth'

with 'auth' been the name of your finder method.

Thanks much! This did the trick!

1 Like