Example #1
0
 /**
  * get list of records
  *
  * @param Tinebase_Model_Filter_FilterGroup|optional $_filter
  * @param Tinebase_Model_Pagination|optional $_pagination
  * @param boolean $_getRelations
  * @param boolean $_onlyIds
  * @param string $_action for right/acl check
  * @return Tinebase_Record_RecordSet|array
  */
 public function search(Tinebase_Model_Filter_FilterGroup $_filter = NULL, Tinebase_Record_Interface $_pagination = NULL, $_getRelations = FALSE, $_onlyIds = FALSE, $_action = 'get')
 {
     $this->_checkRight($_action);
     $this->checkFilterACL($_filter, $_action);
     $this->_addDefaultFilter($_filter);
     $result = $this->_backend->search($_filter, $_pagination, $_onlyIds);
     if (!$_onlyIds) {
         if ($_getRelations) {
             $result->setByIndices('relations', Tinebase_Relations::getInstance()->getMultipleRelations($this->_modelName, $this->_backend->getType(), $result->getId()));
         }
         if ($this->resolveCustomfields()) {
             Tinebase_CustomField::getInstance()->resolveMultipleCustomfields($result);
         }
     }
     return $result;
 }
 /**
  * get list of records
  *
  * @param Tinebase_Model_Filter_FilterGroup|optional $_filter
  * @param Tinebase_Model_Pagination|optional $_pagination
  * @param boolean|array $_getRelations
  * @param boolean $_onlyIds
  * @param string $_action for right/acl check
  * @return Tinebase_Record_RecordSet|array
  */
 public function search(Tinebase_Model_Filter_FilterGroup $_filter = NULL, Tinebase_Record_Interface $_pagination = NULL, $_getRelations = FALSE, $_onlyIds = FALSE, $_action = 'get')
 {
     $this->_checkRight($_action);
     $this->checkFilterACL($_filter, $_action);
     $this->_addDefaultFilter($_filter);
     $result = $this->_backend->search($_filter, $_pagination, $_onlyIds);
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Got ' . count($result) . ' search results');
     }
     if (!$_onlyIds) {
         if ($_getRelations && count($result) > 0 && $result->getFirstRecord()->has('relations')) {
             // if getRelations is true, all relations should be fetched
             if ($_getRelations === true) {
                 $_getRelations = NULL;
             }
             $result->setByIndices('relations', Tinebase_Relations::getInstance()->getMultipleRelations($this->_modelName, $this->_getBackendType(), $result->getId(), NULL, array(), FALSE, $_getRelations));
         }
         if ($this->resolveCustomfields()) {
             Tinebase_CustomField::getInstance()->resolveMultipleCustomfields($result);
         }
     }
     return $result;
 }