Skip to content
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

add docs on how to limit associations #7656

Closed
wants to merge 2 commits into from
Closed

Conversation

LordSimal
Copy link
Contributor

@LordSimal LordSimal commented Jul 24, 2023

This is a blatant copy with some minor adjustments of https://stackoverflow.com/questions/30241975/how-to-limit-contained-associations-per-record-group/30270675#30270675

Thanks to @ndm2 to provide this kind of documentation on stackoverflow but especially recently people keep asking for this kind of feature so we should add this to the official cookbook.

I left the example the same so I don't have to adjust any code or SQL statments 😅

See https://cakephp.pfiff.me/en/orm/limit-associations.html for the generated version of this RST.

Refs: cakephp/cakephp#17192

@LordSimal LordSimal added this to the 4.x milestone Jul 24, 2023
@LordSimal LordSimal requested a review from ndm2 July 24, 2023 19:34
en/orm/limit-associations.rst Outdated Show resolved Hide resolved
en/orm/limit-associations.rst Outdated Show resolved Hide resolved
en/orm/limit-associations.rst Outdated Show resolved Hide resolved
@ndm2
Copy link
Contributor

ndm2 commented Jul 25, 2023

I'm not sure if putting the association examples from SO to the forefront is ideal here, as they can only limit to a single associated record, not to a "first few" ones as the introduction states.

Maybe it should rather first show Plugin usage and manual querying for multiple associated records, and solutions for single records last.

@LordSimal LordSimal marked this pull request as draft July 31, 2023 11:55
@LordSimal
Copy link
Contributor Author

I will try to come back to this after I'm back from the US.

@LordSimal LordSimal closed this Nov 10, 2023
@LordSimal LordSimal deleted the 4.x-limit-associations branch November 10, 2023 17:12
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.

5 participants