markhuot / craft-forced-eager
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- craftcms/cms: ^4.3
README
A Yii2 Extension that will throw errors whenever a relationship field is accessed lazily.
Scrolling down the stack trace should show you the exact line of Twig code that prompted the error.
You can prevent exceptions in one of two ways,
- Use the
.with(['fieldHandle'])
syntax to eager load the field (preferred) - Silence the error with
.allowLazyRelations()
on the query, e.g.,craft.entries.allowLazyRelations().limit(10)
.