简体   繁体   English

Yii2 Restful API具有数据访问对象而不是活动记录

[英]Yii2 restful API with data access objects instead of active record

According to docs http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html use active record is the recommended way to implement restful api in Yii2. 根据http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html的文档,使用活动记录是在Yii2中实现静态API的推荐方法。

The thing is a I want to avoid active record and use data access object ( http://www.yiiframework.com/doc-2.0/guide-db-dao.html ) instead, and I'm looking for a example. 我要避免活动记录,而使用数据访问对象( http://www.yiiframework.com/doc-2.0/guide-db-dao.html ),我正在寻找一个示例。

You should use base Controller and construct new action for DAO. 您应该使用基本Controller并为DAO构造新的动作。 See on the rest folder and rewrite actions. 其余文件夹上查看并重写操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM