markhuot/craft-forced-eager

安装: 10

依赖: 0

建议者: 0

安全: 0

星星: 0

关注者: 2

分支: 0

公开问题: 0

类型:yii2-extension

1.0.1 2023-02-10 22:10 UTC

This package is auto-updated.

Last update: 2024-09-11 01:52:38 UTC


README

一个 Yii2 扩展,当访问关系字段时将抛出错误。

Forced Eager Loading

滚动堆栈跟踪应显示引发错误的Twig代码的确切行。

您可以通过以下两种方式之一防止异常:

  1. 使用 .with(['fieldHandle']) 语法预加载字段(推荐)
  2. 在查询上使用 .allowLazyRelations() 静默错误,例如,craft.entries.allowLazyRelations().limit(10)