Use ?? operator instead of CRM_Utils_Array::value() when fetching ids
[civicrm-core.git] / CRM / Core / BAO / Tag.php
index ae94d043eaf4931fab6d6179b0f09390007311ab..623dd412dee1d8395bf91d3984ffd71ed0d403fc 100644 (file)
@@ -393,7 +393,7 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
    *   object on success, otherwise null
    */
   public static function add(&$params, $ids = []) {
-    $id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('tag', $ids));
+    $id = $params['id'] ?? $ids['tag'] ?? NULL;
     if (!$id && !self::dataExists($params)) {
       return NULL;
     }
@@ -453,6 +453,8 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
       );
     }
 
+    CRM_Core_PseudoConstant::flush();
+
     return $tag;
   }