// Number of characters in the menu js cache key
const CACHE_KEY_STRLEN = 8;
+ /**
+ * Override parent method to flush caches after a write op.
+ *
+ * Note: this only applies to APIv4 because v3 uses the singular writeRecord.
+ *
+ * @param array[] $records
+ * @return CRM_Core_DAO_Navigation[]
+ * @throws CRM_Core_Exception
+ */
+ public static function writeRecords($records): array {
+ $results = [];
+ foreach ($records as $record) {
+ $results[] = self::writeRecord($record);
+ }
+ self::resetNavigation();
+ return $results;
+ }
+
+ /**
+ * Override parent method to flush caches after delete.
+ *
+ * Note: this only applies to APIv4 because v3 uses the singular writeRecord.
+ *
+ * @param array[] $records
+ * @return CRM_Core_DAO_Navigation[]
+ * @throws CRM_Core_Exception
+ */
+ public static function deleteRecords(array $records) {
+ $results = [];
+ foreach ($records as $record) {
+ $results[] = self::deleteRecord($record);
+ }
+ self::resetNavigation();
+ return $results;
+ }
+
/**
* Update the is_active flag in the db.
*