* @param CRM_Core_DAO_Domain $domain
*/
public static function onPostSave($domain) {
+ // We want to clear out any cached tokens.
+ // Editing a domain is so rare we can risk being heavy handed.
+ Civi::cache('metadata')->clear();
Civi::$statics[__CLASS__]['current'] = NULL;
}
/**
- * Fetch object based on array of properties.
+ * Retrieve DB object and copy to defaults array.
*
* @param array $params
- * (reference ) an assoc array of name/value pairs.
+ * Array of criteria values.
* @param array $defaults
- * (reference ) an assoc array to hold the flattened values.
+ * Array to be populated with found values.
*
- * @return CRM_Core_DAO_Domain
+ * @return self|null
+ * The DAO object, if found.
+ *
+ * @deprecated
*/
- public static function retrieve(&$params, &$defaults) {
- return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_Domain', $params, $defaults);
+ public static function retrieve($params, &$defaults) {
+ return self::commonRetrieve(self::class, $params, $defaults);
}
/**
* @param int $id
*
* @return CRM_Core_DAO_Domain
+ * @throws \CRM_Core_Exception
*/
- public static function edit($params, $id) {
+ public static function edit($params, $id): CRM_Core_DAO_Domain {
$params['id'] = $id;
return self::writeRecord($params);
}