我在 Yii 中使用第三方扩展,我想知道是否可以在扩展中使用模型。
扩展在我的数据库上创建一个表,并且模型与我的user
表具有关系规则。我在user
模型上向扩展的模型添加了关系。
当我执行findAll
查询时,它会抛出一个错误:include(ExtensionModel.php): failed to open stream: No such file or directory
。
如何在第三方扩展中使用模型?
请看一下手册。在简单的情况下,您只需要将其包含在第三方文件中:
require_once('path/to/yii.php');
Yii::createWebApplication('path/to/config.php');
我认为这会有所帮助 - 请参阅下面的代码:
require_once('path/to/yii.php');
Yii::createWebApplication('path/to/config.php');