Using config vs db.xml/model for a package
Permalink
Hi,
I was reading the doc during i'm eating. I found the config page that explain that you can save some key/value for a specific package.
In the case of a Theme, it seems t be really more easy to use config than a db file associated with a model.
My question is : is a good way, is efficient, is faster, to use config in place of a db/model ?
Thanks a lot.
Seb
I was reading the doc during i'm eating. I found the config page that explain that you can save some key/value for a specific package.
$co = new Config(); $pkg = Package::getByHandle("calendar"); $co->setPackageObject($pkg); $co->save('calendar_mode', 'monthly'); $co->save('calendar_start', 1);
In the case of a Theme, it seems t be really more easy to use config than a db file associated with a model.
My question is : is a good way, is efficient, is faster, to use config in place of a db/model ?
Thanks a lot.
Seb
Config is certainly easy to use. I have in places serialised larger data structures and put them in config. However, I would also say that in a good 50% of the places I have used config this way, I have subsequently moved the data to a separate model.