From b41a58224be90bc16c3a5d7ed426fc59429467c1 Mon Sep 17 00:00:00 2001 From: colemanw Date: Sat, 2 Dec 2023 16:44:30 +0000 Subject: [PATCH] Standalone - Flush cache when saving user role --- .../CRM/Standaloneusers/BAO/Role.php | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/ext/standaloneusers/CRM/Standaloneusers/BAO/Role.php b/ext/standaloneusers/CRM/Standaloneusers/BAO/Role.php index ad9305b61c..45a85eafe8 100644 --- a/ext/standaloneusers/CRM/Standaloneusers/BAO/Role.php +++ b/ext/standaloneusers/CRM/Standaloneusers/BAO/Role.php @@ -3,28 +3,15 @@ use CRM_Standaloneusers_ExtensionUtil as E; // phpcs:enable -class CRM_Standaloneusers_BAO_Role extends CRM_Standaloneusers_DAO_Role { +class CRM_Standaloneusers_BAO_Role extends CRM_Standaloneusers_DAO_Role implements \Civi\Core\HookInterface { /** - * Create a new Role based on array-data - * - * @param array $params key-value pairs - * @return CRM_Standaloneusers_DAO_Role|NULL + * Event fired after an action is taken on a Role record. + * @param \Civi\Core\Event\PostEvent $event */ - /* - public static function create($params) { - $className = 'CRM_Standaloneusers_DAO_Role'; - $entityName = 'Role'; - $hook = empty($params['id']) ? 'create' : 'edit'; - - CRM_Utils_Hook::pre($hook, $entityName, CRM_Utils_Array::value('id', $params), $params); - $instance = new $className(); - $instance->copyValues($params); - $instance->save(); - CRM_Utils_Hook::post($hook, $entityName, $instance->id, $instance); - - return $instance; + public static function self_hook_civicrm_post(\Civi\Core\Event\PostEvent $event) { + // Reset cache + Civi::cache('metadata')->clear(); } - */ } -- 2.25.1