简体   繁体   English

CodeIgniter + RedBean:我仍然需要“模型”吗?

[英]CodeIgniter + RedBean : Do I still need “model”?

I'm just trying to dive into CodeIgniter + RedBean ORM. 我只是想深入研究CodeIgniter + RedBean ORM。

Been glancing through some examples and think it's good enough to get started. 浏览了一些示例,并认为它足以入门。

However, it seems like using RedBean eliminates the need to use CodeIgniter models? 但是,似乎使用RedBean消除了使用CodeIgniter模型的需要? Looks like you can do most of the DB-related things right from the Controllers. 看起来您可以直接在Controllers中完成大多数与DB相关的事情。

Is this true? 这是真的? (and at a higher level, is it true for most of the ORMs?) (在更高的级别上,对于大多数ORM来说是否正确?)

It's true but not because of RedBean . 是真的,但不是因为RedBean You can use CodeIgniter without model if you want but it's good to keep it separate. 您可以根据需要使用不带模型的CodeIgniter ,但最好将其分开。

CodeIgniter has a fairly loose approach to MVC since Models are not required. 因为不需要模型,所以CodeIgniter对MVC的方法相当宽松。 If you don't need the added separation, or find that maintaining models requires more complexity than you want, you can ignore them and build your application minimally using Controllers and Views. 如果您不需要额外的分隔,或者发现维护模型所需的复杂性超出了您的期望,则可以忽略它们,并使用Controllers和Views最少地构建应用程序。 CodeIgniter also enables you to incorporate your own existing scripts, or even develop core libraries for the system, enabling you to work in a way that makes the most sense to you. CodeIgniter还使您能够合并自己的现有脚本,甚至为系统开发核心库,从而使您能够以最有意义的方式进行工作。

You can use queries from inside your controller directly. 您可以直接从控制器内部使用查询。

Model-View-Controller 模型视图控制器

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

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