Grouping WHERE clauses with Zend_Db_Table_Abstract

前端 未结 5 2002
无人共我
无人共我 2020-12-02 17:30

Does anyone know of a way to group where clauses with Zend_Db? Basically I have this query

$sql = $table->select()
             ->where(\'company_id =          


        
5条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 17:48

    For Zend Framework Version 2, things differ a bit:

    See http://framework.zend.com/apidoc/2.2/classes/Zend.Db.Sql.Predicate.Predicate.html#nest

    $table->select()
         ->where(['company_id'=> $company_id])
         ->nest
             ->where('client_email = ?', $client_email)
             ->or
             ->where('client_email_alt = ?', $client_email)
         ->unnest();
    

    works fine and feels much cleaner than the ZF1 methods.

提交回复
热议问题