/** * adds a new relation * * @param Tinebase_Model_Relation $_relation * @return Tinebase_Model_Relation|NULL the new relation * @throws Tinebase_Exception_Record_Validation */ protected function _addRelation(Tinebase_Model_Relation $_relation) { $_relation->created_by = Tinebase_Core::getUser()->getId(); $_relation->creation_time = Tinebase_DateTime::now(); if (!$_relation->isValid()) { throw new Tinebase_Exception_Record_Validation('Relation is not valid' . print_r($_relation->getValidationErrors(), true)); } try { $result = $this->_backend->addRelation($_relation); } catch (Zend_Db_Statement_Exception $zse) { Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Could not add relation: ' . $zse->getMessage()); $result = NULL; } return $result; }