Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow env config for attributes #13666

Draft
wants to merge 2 commits into
base: 5.x
Choose a base branch
from
Draft

Conversation

timkelty
Copy link
Contributor

@timkelty timkelty commented Sep 7, 2023

Description

Detects if you pass \craft\helpers\App::envConfig a Model, and if so, uses the the model's attributes instead of just getting public properties.

This allows config overrides to work if you have an attribute with a getter/setter.

Another option could be to just allow you to pass an array of properties to override, so when you called \craft\helpers\App::envConfig, you could just pass if your model's attributes.

One potential issue here might be if you have a read-only attribute (no setter), and you try to set the corresponding env for it, it will throw.

@brandonkelly
Copy link
Member

This allows config overrides to work if you have an attribute with a getter/setter.

Typecast would need to be updated to support that as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants