Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nook24
Copy link
Contributor

@nook24 nook24 commented Sep 22, 2025

The existsIn rule expects the second parameter to be Table|Association|string $table So I expected it to be with plugin prefix like Pluginname.Tablename
This throws an error:

ExistsIn rule for `object_id` is invalid. `Pluginname.Tablename` is not associated with `AssociatedTablename`.

CakePHP uses the associated table name instead of the Table name, so in my opinion $associated is a better name for the parameter than $table to make this more clear.

@dereuromark
Copy link
Member

This should target 5.next
As people could be using named params

public function existsIn(
array|string $field,
Table|Association|string $table,
Table|Association|string $associated,
Copy link
Member

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.

Copy link
Contributor Author

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.

@dereuromark
Copy link
Member

dereuromark commented Oct 7, 2025

ping @nook24

PHPCS fail seems related

@dereuromark dereuromark changed the base branch from 5.x to 5.next October 7, 2025 11:53
@dereuromark dereuromark added this to the 5.3.0 milestone Oct 7, 2025
@nook24
Copy link
Contributor Author

nook24 commented Oct 13, 2025

Sorry for my late response, I was on vacation. I will take a look at PHPCS.

@othercorey
Copy link
Member

@nook24 Do you think you can finish fixing the errors?

@dereuromark
Copy link
Member

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.

@ADmad
Copy link
Member

ADmad commented Oct 29, 2025

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.

@nook24
Copy link
Contributor Author

nook24 commented Oct 29, 2025

Sorry I wasn't giving this much attention. It was not my intention to waste your time.

For the 5.x branch I have created a new Pr which will only update the docblock. #19010
As suggested, I will send a new PR for the 6.x branch.

@nook24 nook24 closed this Oct 29, 2025
@ADmad
Copy link
Member

ADmad commented Oct 29, 2025

Sorry I wasn't giving this much attention. It was not my intention to waste your time.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants