Answer the question
In order to leave comments, you need to log in
Is it possible to change config data in Yii 1 not in the file itself?
Yii has a config folder with the main configuration file, where the script returns an array with configuration data. Is it possible to change these configuration data later from other classes, for example, to change the data for the database? If so, how can you access this data using Yii?
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
I suspect that you need to use multiple databases. To do this, simply add a component with the CDBConnection class.
I see no point in editing the config after it has been loaded, because it is not reread after launch.
To override config elements in the module, there are methods of the CModule class - setComponent or setComponents.
To use different configurations, for example, in dev and prod environments, you can create a separate file in the config folder for the local environment, for example local.php, where you can override the data for connecting to the database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question