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

💡 Efficient bulk-loading of morph relations #488

Open
rauanmayemir opened this issue Jun 6, 2024 · 0 comments
Open

💡 Efficient bulk-loading of morph relations #488

rauanmayemir opened this issue Jun 6, 2024 · 0 comments
Labels
type:feature New feature.

Comments

@rauanmayemir
Copy link
Contributor

I have an idea!

Example relation:

class Parent
{
    #[Cycle\Relation\Morphed\BelongsToMorphed(
        target: ChildInterface::class,
        innerKey: 'child_id',
        morphKey: 'child_type',
    )]
    public ?ChildInterface $child = null;

When querying multiple parents with $select->load('child'), I want cycle to efficiently split up all child_type's and bulk-query each of them. I.e: if I have 50 parents with 20 childs of child1 and 30 childs of child2, it will take only 2 queries to load them: 1 for child1 and 1 for child2.

@rauanmayemir rauanmayemir added the type:feature New feature. label Jun 6, 2024
@roxblnfk roxblnfk moved this to Todo in Cycle Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature.
Projects
Status: Todo
Development

No branches or pull requests

1 participant