cakephp: Contain usage of custom finder not working
This is a (multiple allowed):
-
bug
-
enhancement
-
feature-discussion (RFC)
-
CakePHP Version: 3.4.0
-
Platform and Target: Apache 2, PHP 7.1.1, MySQL 5.7
What you did
$jobs = $this->Jobs->find('active')
->contain(['JobLogs' => [
'strategy' => 'select',
'finder' => ['orphan' => ['node_id' => $nc->node_id()]]
]]);
Jobs is returned with all JobLogs records.
What happened
Confirmed that finder is not called.
public function findOrphan(Query $query, array $options = [])
{
dd('findOrphan');
}
What you expected to happen
Finder for contain should be used instead of find “All”.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (15 by maintainers)
I’m closing because I think there are already enough options for contain, no need to make it more complex than it already is. Just pass any callable to
queryBuilder!Digging further In the code I can see the docs for
finderwhere added by the author of that stackoverflow response, and that there is one shy test in the code to support it’s usage. Given that I don’t remember adding that, and it was probably me who did, I think I’ll just deprecate it.The excess of alternative syntax makes it difficult to not break things when refactoring