copyValues($params); return $caseTypeDAO->save(); } /** * Given the list of params in the params array, fetch the object * and store the values in the values array * * @param array $params input parameters to find object * @param array $values output values of the object * @param array $ids the array that holds all the db ids * * @return CRM_Case_BAO_CaseType|null the found object or null * @access public * @static */ static function &getValues(&$params, &$values) { $caseType = new CRM_Case_BAO_CaseType(); $caseType->copyValues($params); if ($caseType->find(TRUE)) { CRM_Core_DAO::storeValues($caseType, $values); return $caseType; } return NULL; } /** * takes an associative array and creates a case type object * * @param array $params (reference ) an assoc array of name/value pairs * @param array $ids the array that holds all the db ids * * @return object CRM_Case_BAO_CaseType object * @access public * @static */ static function &create(&$params) { $transaction = new CRM_Core_Transaction(); if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'CaseType', $params['id'], $params); } else { CRM_Utils_Hook::pre('create', 'CaseType', NULL, $params); } $caseType = self::add($params); if (is_a($caseType, 'CRM_Core_Error')) { $transaction->rollback(); return $caseType; } if (!empty($params['id'])) { CRM_Utils_Hook::post('edit', 'CaseType', $caseType->id, $case); } else { CRM_Utils_Hook::post('create', 'CaseType', $caseType->id, $case); } $transaction->commit(); return $caseType; } /** * Takes a bunch of params that are needed to match certain criteria and * retrieves the relevant objects. We'll tweak this function to be more * full featured over a period of time. This is the inverse function of * create. It also stores all the retrieved values in the default array * * @param array $params (reference ) an assoc array of name/value pairs * @param array $defaults (reference ) an assoc array to hold the name / value pairs * in a hierarchical manner * @param array $ids (reference) the array that holds all the db ids * * @return object CRM_Case_BAO_CaseType object * @access public * @static */ static function retrieve(&$params, &$defaults) { $caseType = CRM_Case_BAO_CaseType::getValues($params, $defaults); return $caseType; } static function del($caseTypeId) { $caseType = new CRM_Case_DAO_CaseType(); $caseType->id = $caseTypeId; return $caseType->delete(); } }