Option arrays versus settes in CakePHP

How does everyone feel about the use of option arrays in CakePHP? I personally prefer using OOP for setting options. In particular I can rely on my IDE to provide documentation as I code rather than having to search through documentation or vendor source code.

Here is an example of what I am talking about:

$service->loadAuthenticator('Authentication.Token', [
    'queryParam' => 'token',
    'header' => 'Authorization',
    'tokenPrefix' => 'Token'


    (new AuthenicationToken())

Same, i do convert all the baked models to use chained relations setters


I usually make mistakes with the first option, so in my very personal opinion, I like a lot more the second one.

1 Like

I prefer the OOP for its structure, but most of my code uses array as I find it faster and easier (with the thought that the keys do not change).

Sounds greedy, but I would like to have both.

$this->Users->find('all', [...]);
1 Like