我正在尝试在 Phalcon 中获取模型以获取带有条件参数的数据,以便通过静态调用获取数据::find()
并将与其外部相关的参数传递给它:
ProductReports::find(array(
"order.order_status_id = 6"
));
给出错误:
Error fetching
ProductReportsreport: exception 'Phalcon\Mvc\Model\Exception' with message 'Syntax error, unexpected token ORDER, near to '.order_status_id = 6', when parsing: SELECT [ProductReports].* FROM [ProductReports] WHERE order.order_status_id = 6 (113)
/**
* Class ProductReports
*
* @Source('product_reports');
*
* @BelongsTo('order_id', 'Orders', 'order_id', {'alias':'order'});
*/
class ProductReports extends Model
有没有办法获取静态::find()
过滤它的关系,而不是做一个foreach循环order
(用它的关系别名过滤单行)?