Ticket #878 (new new feature)
Implement application settings persistence.
| Reported by: | sergeymorkovkin | Owned by: | xue |
|---|---|---|---|
| Priority: | low | Milestone: | 3.2 |
| Component: | Prado Framework v3 | Version: | 3.1 |
| Severity: | minor | Keywords: | |
| Cc: |
Description
Currently Prado's only supporting reading xml configuration. I suggest to implement functionality to persist this configuration. Everything that's required is to implement the following interface:
interface IConfigPersister { public function save(TXmlElement &$config); }
Calling TApplication::writeConfig() will run through all objects in the configuration and ask them (application, modules and services) to persist their settings into XmlElement?. Only those items that support this interface will persist their settings. Other XmlElements? will stay unchanged.
With this concept we have all things in-place. No additional classes to load and manage application.xml. This is how it'll work:
$app = $this->getApplication(); $mod = $app->getModule('error'); $mod->setErrorUrl('google.com'); $app->writeConfig();
It's also important to implement protected methods that separately manage how file is read/written since users of IonCube/Zend? may want to encrypt settings file.
