编程语言
首页 > 编程语言> > php – 使用Zend框架时从多个表中获取数据?

php – 使用Zend框架时从多个表中获取数据?

作者:互联网

是否有使用Zend从多个数据库表中获取数据的最佳实践?我想知道而不是最终想要重构我在不久的将来编写的代码.我正在阅读Zend文档,它说:

“You can not specify columns from a
JOINed tabled to be returned in a
row/rowset. Doing so will trigger a
PHP error. This was done to ensure
the integrity of the Zend_Db_Table is
retained. i.e. A Zend_Db_Table_Row
should only reference columns derived
from its parent table.”

我假设我因此需要使用多个模型 – 这是正确的吗?例如,如果我想要获取特定用户ID的所有订单,其中日期介于两个日期之间,我该怎么做?

我知道可以从一个控制器访问两个不同的模型,然后在动作中结合它们各自的数据但我不会感到高兴这样做,因为我一直在阅读survthedeepend.com和it tells me that I shouldn’t do this

在哪里,为什么以及如何?

标签:php,zend-framework,zend-db-table
来源: https://codeday.me/bug/20190526/1158201.html