/** * convert input to recordset * * input can have the following datatypes: * - Tinebase_Model_Filter_FilterGroup * - Tinebase_Record_RecordSet * - Tinebase_Record_Abstract * - string (single id) * - array (multiple ids) * * @param mixed $_mixed * @param boolean $_refresh if this is TRUE, refresh the recordset by calling getMultiple * @param Tinebase_Model_Pagination $_pagination (only valid if $_mixed instanceof Tinebase_Model_Filter_FilterGroup) * @return Tinebase_Record_RecordSet */ protected function _convertToRecordSet($_mixed, $_refresh = FALSE, Tinebase_Model_Pagination $_pagination = NULL) { if ($_mixed instanceof Tinebase_Model_Filter_FilterGroup) { // FILTER (Tinebase_Model_Filter_FilterGroup) $result = $this->search($_mixed, $_pagination); } elseif ($_mixed instanceof Tinebase_Record_RecordSet) { // RECORDSET (Tinebase_Record_RecordSet) $result = $_refresh ? $this->_backend->getMultiple($_mixed->getArrayOfIds()) : $_mixed; } elseif ($_mixed instanceof Tinebase_Record_Abstract) { // RECORD (Tinebase_Record_Abstract) if ($_refresh) { $result = $this->_backend->getMultiple($_mixed->getId()); } else { $result = new Tinebase_Record_RecordSet(get_class($_mixed), array($_mixed)); } } elseif (is_string($_mixed) || is_array($_mixed)) { // SINGLE ID or ARRAY OF IDS $result = $this->_backend->getMultiple($_mixed); } else { if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) { Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Could not convert input param to RecordSet: Unsupported type: ' . gettype($_mixed)); } $result = new Tinebase_Record_RecordSet($this->_modelName); } return $result; }
/** * returns quoted column name for sql backend * * @param Tinebase_Backend_Sql_Interface $_backend * @return string * * @todo to be removed once we split filter model / backend */ protected function _getQuotedFieldName($_backend) { $tablename = isset($this->_options['tablename']) ? $this->_options['tablename'] : $_backend->getTableName(); if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) { Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . 'Using tablename: ' . $tablename); } return $_backend->getAdapter()->quoteIdentifier($tablename . '.' . $this->_field); }
/** * returns quoted column name for sql backend * * @param Tinebase_Backend_Sql_Interface $_backend * @return string * * @todo to be removed once we split filter model / backend */ protected function _getQuotedFieldName($_backend) { return $_backend->getAdapter()->quoteIdentifier('attendee.status'); }