-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
join()
comes before contain()
, results in "Column not found"
#17680
Comments
This is likely caused by join() clauses being separate from contain() clauses. The reason for this separation is that not all contain() operations generate joins. #17184 is somewhat related. |
@markstory but shouldn't it generate a bunch of left joins because it's a chain of One can normally get Product to Category to Store all in one query |
Sure, in your situation that is true, but that isn't always the case as contain() can be used for all association types. |
Description
What I have
What happens
In the query that CakePHP generates for that find, my manual join I defined last actually comes before the "contained" tables.
As a result,
What I expected to happen
Because I defined the
join()
aftercontain()
, I expected the contained tables to be available before the join kicks in.If I copy the SQL from DebugKit and manually edit it to where the contained tables are joined first, the query works when I run it in Workbench
CakePHP Version
4.4.14
PHP Version
8.3.1
The text was updated successfully, but these errors were encountered: