Zend Db Select?加入*条件中的替换

Koo*_*obz 6 php zend-framework zend-db

它看起来不像Zend_Db_Select's on子句中有任何参数替换.

我不能只做以下事情,这非常烦人:

$select->joinLeft('st_line_item','st_line_item.order_id = st_order.id and st_line_item.status = ?')
Run Code Online (Sandbox Code Playgroud)

那么在流畅的界面中有什么惯用的替代方案呢?我可以做一些事情,比如在外面准备连接子句,但这不是重点.

Noa*_*ich 10

这应该工作:

$select->joinLeft(
    'st_line_item',
    $this->_db->quoteInto(
        'st_line_item.order_id = st_order.id and st_line_item.status = ?', 
        $param
    )
)
Run Code Online (Sandbox Code Playgroud)

基本上,任何时候你想要转义Zend_Db_*方法不自动执行的变量,你只需使用Zend_Db :: quoteInto()来完成这项工作.