Closed devanflaherty closed 3 years ago
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?
Sorry - happy to be mentioned, but probably not my field of expertise. (And apologies for the very late follow up.)
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...
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!