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

[FR] Support for eager loading through 'criteria' #14

Closed
devanflaherty opened this issue Dec 17, 2018 · 3 comments
Closed

[FR] Support for eager loading through 'criteria' #14

devanflaherty opened this issue Dec 17, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@devanflaherty
Copy link

Hey there,
Thank you for the awesome plugin, it accomplishes exactly what I was looking for!

I was curious if you were planning to support eager loading through the find() criteria attribute.

I have my $limitCriteria all set and have my eager loaded elements defined within ->with(), but it seems the way the method ends up getting each $model after the results have been found (by $elements->getElementById()) doesn't account for eager loading.

Supporting this would be awesome, but if that's not something on the horizon or maybe there is a reason it isn't accounted for please let me know!

@khalwat khalwat changed the title Support for eager loading through 'criteria' [FR] Support for eager loading through 'criteria' Jan 5, 2019
@khalwat khalwat added the enhancement New feature or request label Jan 5, 2019
@khalwat
Copy link
Contributor

khalwat commented Jan 5, 2019

Added it as a FR -- I'm always open to pull requests!

Just looking at the code quickly, probably:

                $model = $elements->getElementById($config['id'], $elementClass, $config['siteId']);

...would need to be changed to an $elementClass::find() element query, which would have the added benefit of being able to do it all at once (by passing in the array of found IDs), and you could add the with there as well.

Maybe @svale has an interest?

@svale
Copy link
Contributor

svale commented Apr 19, 2019

Sorry - happy to be mentioned, but probably not my field of expertise. (And apologies for the very late follow up.)

khalwat pushed a commit that referenced this issue Mar 3, 2021
Resolve #14
@khalwat
Copy link
Contributor

khalwat commented Mar 3, 2021

This should be fixed in the dev-develop branch

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-similar": "dev-develop as 1.1.0”,

Then do a composer update

Let me know how you go...

@khalwat khalwat closed this as completed Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants