id]); return civicrm_api3_create_success($relType, $params, 'relationship_type', 'create', $relationType); } /** * Adjust Metadata for Create action * * The metadata is used for setting defaults, documentation & validation * @param array $params array or parameters determined by getfields */ function _civicrm_api3_relationship_type_create_spec(&$params) { $params['contact_type_a']['api.required'] = 1; $params['contact_type_b']['api.required'] = 1; $params['name_a_b']['api.required'] = 1; $params['name_b_a']['api.required'] = 1; } /** * Function to get all relationship type * retruns An array of Relationship_type * @access public * {@getfields RelationshipType_get} * @example RelationshipTypeGet.php */ function civicrm_api3_relationship_type_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** * Delete a relationship type delete * * @param id of relationship type $id * * @return array API Result Array * {@getfields RelationshipType_delete} * @static void * @access public */ function civicrm_api3_relationship_type_delete($params) { require_once 'CRM/Utils/Rule.php'; if ($params['id'] != NULL && !CRM_Utils_Rule::integer($params['id'])) { return civicrm_api3_create_error('Invalid value for relationship type ID'); } $relationTypeBAO = new CRM_Contact_BAO_RelationshipType(); $result = $relationTypeBAO->del($params['id']); if (!$result) { return civicrm_api3_create_error('Could not delete relationship type'); } return civicrm_api3_create_success($result, $params, 'relationship_type', 'delete', $relationTypeBAO); }