-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Use associated as a table name passed as string such as Plugin.Table will not work
#18919
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
Conversation
…` will not work CakePHP uses the name of the association instead the Table name
|
This should target 5.next |
| public function existsIn( | ||
| array|string $field, | ||
| Table|Association|string $table, | ||
| Table|Association|string $associated, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to rename the parameter? This is kind of a breaking change with named parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name table was tricking me into thinking I have to pass a Table name. Twice now. So in my opinion the name is wrong, since it does not expect a table name but the name of the association.
But I didn't think of a named parameter tbh. It's up to you guys how to proceed with this. My PR is just a suggestion.
|
ping @nook24 PHPCS fail seems related |
|
Sorry for my late response, I was on vacation. I will take a look at PHPCS. |
|
@nook24 Do you think you can finish fixing the errors? |
|
We should probably close this, and instead check if the docblocks could be improved. Changing the arg name over this seems not worth it after all. |
I agree. @nook24 You can submit this argument rename for 6.x. For 5.x you are welcome to submit improvement to the docs/docblock. |
|
Sorry I wasn't giving this much attention. It was not my intention to waste your time. For the |
No apologies necessary, you raised a valid concern. It's just that it needs to be addressed a bit more caustiously to avoid any backwards compatibility issues. |
The
existsInrule expects the second parameter to beTable|Association|string $tableSo I expected it to be with plugin prefix likePluginname.TablenameThis throws an error:
CakePHP uses the associated table name instead of the Table name, so in my opinion
$associatedis a better name for the parameter than$tableto make this more clear.