/** * Takes a bunch of params that are needed to match certain criteria and * retrieves the relevant objects. Typically the valid params are only * contact_id. 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 flattened values * * @return object CRM_Grant_BAO_ManageGrant object * @access public * @static */ static function retrieve(&$params, &$defaults) { $grant = new CRM_Grant_DAO_Grant(); $grant->copyValues($params); if ($grant->find(true)) { CRM_Core_DAO::storeValues($grant, $defaults); return $grant; } return null; }
/** * Delete the grant. * * @param int $id * Grant id. * * @return bool|mixed */ public static function del($id) { CRM_Utils_Hook::pre('delete', 'Grant', $id, CRM_Core_DAO::$_nullArray); $grant = new CRM_Grant_DAO_Grant(); $grant->id = $id; $grant->find(); // delete the recently created Grant $grantRecent = array('id' => $id, 'type' => 'Grant'); CRM_Utils_Recent::del($grantRecent); if ($grant->fetch()) { $results = $grant->delete(); CRM_Utils_Hook::post('delete', 'Grant', $grant->id, $grant); return $results; } return FALSE; }
/** * Function to delete the grant * * @param int $id grant id * * @access public * @static * */ static function del($id) { require_once 'CRM/Grant/DAO/Grant.php'; $grant = new CRM_Grant_DAO_Grant(); $grant->id = $id; $grant->find(); // delete the recently created Grant require_once 'CRM/Utils/Recent.php'; $grantRecent = array('id' => $id, 'type' => 'Grant'); CRM_Utils_Recent::del($grantRecent); while ($grant->fetch()) { return $grant->delete(); } return false; }