CakePHP 3.6: Auth custom finder create wrong SQL query

Here is code:

AppController

'authenticate' => [
                'Form' => [
                    'finder' => 'emailOrNameAuth',
                    'fields' => ['username' => 'name', 'password' => 'password']
                ]
            ],

Users table:
#options 1:

public function findEmailOrNameAuth(\Cake\ORM\Query $query, array $options)
{
    $query
        ->where([
            'OR' => [
                ['email' => $options['username']]
            ],
            'activated' => 1,
        ]);
    return $query;
}
 // FROM 
  users Users 
WHERE 
  (
    Users.name = 'xxxxxx' 
    AND email = 'xxxxxt' 
    AND activated = 1
  ) 

Old deprecated options return valid query:

public function findEmailOrNameAuth(\Cake\ORM\Query $query, array $options)
{
    $query
       ->orWhere(['email' => $options['username']])
       ->andWhere(['activated' => 1]);
    return $query;
}
// FROM users Users WHERE ((Users.name = :c0 OR email = :c1) AND activated = :c2)

The function Cake\Database\Query::orWhere() has been deprecated: 3.5.0 This method creates hard to predict SQL based on the current query state. Use Query::where() instead as it has more predicatable and easier to understand behavior.

How to fix?

This is a slightly different problem, but the same solution should apply.

Thanks, I have same answer here: