/** * get all relations of a given record * - cache result if caching is activated * * @param string $_model own model to get relations for * @param string $_backend own backend to get relations for * @param string|array $_id own id to get relations for * @param string $_degree only return relations of given degree * @param array $_type only return relations of given type * @param bool $_ignoreACL get relations without checking permissions * @param array $_relatedModels only return relations having this related models * @return Tinebase_Record_RecordSet of Tinebase_Model_Relation */ public function getRelations($_model, $_backend, $_id, $_degree = NULL, array $_type = array(), $_ignoreACL = FALSE, $_relatedModels = NULL) { if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) { Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . " model: '{$_model}' backend: '{$_backend}' "); } $result = $this->_backend->getAllRelations($_model, $_backend, $_id, $_degree, $_type, FALSE, $_relatedModels); $this->resolveAppRecords($result, $_ignoreACL); return $result; }
/** * testBreakAllRelations */ public function testBreakAllRelations() { $rel = $this->relations[0]; $this->object->breakAllRelations($rel->own_model, $rel->own_backend, $rel->own_id); $relations = $this->object->getAllRelations($rel->own_model, $rel->own_backend, $rel->own_id); $this->assertEquals(0, count($relations)); // test that the other relations still exists $rel = $this->relations[2]; $this->object->getRelation($rel->getId(), $rel->related_model, $rel->related_backend, $rel->related_id); }