Repository navigation
Only resolve model method relations once - #270
bennothommo wants to merge 1 commit into
Conversation
Instead of repeating reflection on the model class each time a relation is checked, this does one pass on the first model relation call, and caches the result. Dynamic methods are still checked live each time. Resolves wintercms/winter#1581 Replaces #268 Thanks to @JonasPardon for initial fix.
|
No actionable comments were generated in the recent review.
|
austinderrick
left a comment
There was a problem hiding this comment.
Awesome! Thank you for this!
I've been implementing something like this with a hacky override in my deployments. :)
Instead of repeating reflection on the model class each time a relation is checked, this does one pass on the first model relation call, and caches the result.
Dynamic methods are still checked live each time.
This also resolves a bug where an initial
hasRelationcall would cache a single relation and cause other relation methods (such asgetDefinedRelations) to only return the single relation.Thanks to @JonasPardon for initial idea for fix.
Summary by CodeRabbit