/** * appends sql to given select statement * * @param Zend_Db_Select $_select * @param Tinebase_Backend_Sql_Abstract $_backend */ public function appendFilterSql($_select, $_backend) { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . 'Adding Relation filter: ' . $_backend->getModelName() . ' <-> ' . $this->_options['related_model']); } $this->_resolveForeignIds(); $ownIds = $this->_getOwnIds($_backend->getModelName()); $idField = array_key_exists('idProperty', $this->_options) ? $this->_options['idProperty'] : 'id'; $db = $_backend->getAdapter(); $qField = $db->quoteIdentifier($_backend->getTableName() . '.' . $idField); $_select->where($db->quoteInto("{$qField} IN (?)", empty($ownIds) ? ' ' : $ownIds)); }
/** * appends sql to given select statement * * @param Zend_Db_Select $_select * @param Tinebase_Backend_Sql_Abstract $_backend */ public function appendFilterSql($_select, $_backend) { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . 'Adding Path filter for: ' . $_backend->getModelName()); } $this->_resolvePathIds(); $idField = isset($this->_options['idProperty']) || array_key_exists('idProperty', $this->_options) ? $this->_options['idProperty'] : 'id'; $db = $_backend->getAdapter(); $qField = $db->quoteIdentifier($_backend->getTableName() . '.' . $idField); if (empty($this->_pathRecordIds)) { $_select->where('1=0'); } else { $_select->where($db->quoteInto("{$qField} IN (?)", $this->_pathRecordIds)); } }