Monday, May 2, 2011

Notes: Join tables with setIntegrityCheck(false) Using Zend_Db_Table and Zend_Db_Select

This one lack documentation in ZF website but if you are trying to do a "join" you need to add setIntegrityCheck() and set the value to false or you will get "Select query cannot join with another table"

$select = $table->select(Zend_Db_Table::SELECT_WITH_FROM_PART);
       ->where('bug_status = ?', 'NEW')
       ->join('accounts', 'accounts.account_name = bugs.reported_by')
       ->where('accounts.account_name = ?', 'Bob');