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

RFI: TModule::init loads [configuration] behaviors. #971

Open
belisoful opened this issue Jun 6, 2023 · 2 comments
Open

RFI: TModule::init loads [configuration] behaviors. #971

belisoful opened this issue Jun 6, 2023 · 2 comments

Comments

@belisoful
Copy link
Member

belisoful commented Jun 6, 2023

After studying other platforms a bit, It would be nice to be able to define behaviors within the configuration of a module rather than from an instance of TBehaviorsModule.

Proposal: TModule::init($config) is expanded to read $config for <behavior class='xyz' /> and $config['behaviors'] => behavior|array[behavior]. a behavior is a TBaseBehavior subclass or a string class name or an array for Prado::createComponent.

This will add behaviors to modules. This does replicate the function of TBehaviorModule, but in a way similar to Yii. Also, if modules are getting behavior support, then the main application (and the application configuration) should also get behaviors that apply to the application.

behaviors could also be a page level selection configuration.

@belisoful
Copy link
Member Author

Maybe there could be a protected TModule::getModuleBehaviorObject() {return $this;}. This way a module (ahem: TDataSourceConfig) a module can route a module's configuration behaviors to a managed object, like TDbConnection.

module configuration of behaviors should be in a function by itself. If managed objects are lazy loaded, the behaviors can be "not applied", but stored, and attached when the lazy loading object is loaded.

@ctrlaltca
Copy link
Member

Sounds like a nice improvement

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

No branches or pull requests

2 participants