diff --git a/CHANGELOG.md b/CHANGELOG.md index be1f3f6..9bd7318 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Fix `_modelInstance` cache when keys are not strings * Fix certain settings not being applied if they're created after generating the main system setting object +* Fix settings proxy objects ## 1.4.0-alpha.7 (2024-10-10) diff --git a/lib/core/setting.js b/lib/core/setting.js index 278b44f..e2c325f 100644 --- a/lib/core/setting.js +++ b/lib/core/setting.js @@ -1734,15 +1734,61 @@ const MagicGroupValue = Function.inherits('Magic', 'Alchemy.Setting', function M */ MagicGroupValue.setMethod(function __get(key) { - let result = this[VALUE].get(key); + let result = this[key]; + + if (result != null) { + return result; + } + + result = this[VALUE].get(key); + + if (result == null) { + return this[VALUE][key]; + } if (!result) { - return; + return result; } if (result.is_group) { return result.toProxyObject(); } + if (!result.get) { + return result; + } + return result.get(); +}); + +/** + * The magic getter + * + * @author Jelle De Loecker + * @since 1.4.0 + * @version 1.4.0 + * + * @param {string} key + */ +MagicGroupValue.setMethod(function __ownKeys() { + return Object.keys(this[VALUE].toObject()) +}); + +/** + * The magic getter + * + * @author Jelle De Loecker + * @since 1.4.0 + * @version 1.4.0 + * + * @param {string} key + */ +MagicGroupValue.setMethod(function __describe(key) { + let result = Object.getOwnPropertyDescriptor(this[VALUE], key); + + if (result == null) { + result = Object.getOwnPropertyDescriptor(this, key); + } + + return result; }); \ No newline at end of file