-
Notifications
You must be signed in to change notification settings - Fork 20
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
Association names plural vs singular #240
Comments
The first parameter in ->with() should be the name of the association as defined in the models. Weither the association is plural or not depends on the association name. If Cities has one Countries, then CityFactory::make()->with('Countries'); |
Under HasOne Associations there are examples where asociations are singular, like HomeAddress. I think it is ok to leave the examples as such, mixed plural and singular. |
Yeah, the Cake docs are bit confusing here. $this->belongsTo('Countries', [
'propertyName' => 'country'
]); I opened a PR for discussion as this shouldnt be the case in default docs and conventions: |
The 5.x docs have been fixed up to be consistent: https://book.cakephp.org/5/en/orm/associations.html#hasone-associations Feel free to close if you wanna keep things as they are. |
The docs are a bit confusing to me
https://github.com/vierge-noire/cakephp-fixture-factories/blob/main/docs/associations.md
They link to https://book.cakephp.org/4/en/orm/associations.html (v4 btw, not v5) - in main.
As in Cake, I would assume all relations to be plural
But in this plugin, some things are plural, others are singular.
Shouldnt
be
?
At least the contain() and other relation chaining in Cake would work this way, afaik?
The text was updated successfully, but these errors were encountered: