I have a number of settings that are currently in the config.yml file.
Going forward I want to be able to develop an interface where administrators will be able to update these settings, so I want to be able to manage these settings through the database.
How would I be able to load these settings from the database into Symfony2 and where and when would I load them?
Cheers
Adam
There's a cookbook article that explains roughly how to do this (albeit briefly), in reference to loading in settings externally from Drupal. The basic idea is to do something like this in your config (example is yml):
# app/config/config.yml
imports:
- { resource: parameters.php }
then in parameters.php
you can do whatever you need to to get your config, and set it as follows:
$container->setParameter('my.db.parameter', $value);
(taken from the cookbook, slightly modified).
Take a look at the UnifikDatabaseConfigBundle. It creates a database structure that enable configuration of Symfony parameters straight from the database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With