[symfony-users] Re: Use database in app.yml
This is not the correct way to handle this. Yaml configuration files are meant for static values. If you need something dynamic, this is probably the wrong way to achieve it. In my opinion, a better approach would be to create a filter in the filter chain, righe before the cache filter, that retrieves the settings from the database and adds them in the sfConfig registry. Something like: class SettingsFilter extends sfFilter { public function execute(sfFilterChain $filterChain) { foreach (SettingPeer::getIndex() as $setting) { sfConfig::set('app_' . $setting-getSlug(), $setting- getValue()); } $filterChain-execute(); } } and in the filters.yml rendering: ~ security: ~ # insert your own filters here settings: { class: SettingsFilter } cache: ~ execution: ~ This will keep configuration files clean, and still have the possibility to change the values from a backend, without having dynamic Yaml files. Also remember that yml files are parsed only once, then they're all cached. So even changing the value in the database, Symfony would use the old data resulting of the last time app.yml was parsed. Keep also in mind that whatever way you do, this will add the overhead of a query for each request. A good choice would be to use a cache (APC would be a good choice) that is refreshed each time the settings are updated. I hope this helps :) On Jul 1, 2:51 pm, HAUSa jeroen_heeft_behoefte_aan_r...@hotmail.com wrote: I want to use some configuration settings from the database in my app.yml configuration file. This is my code now: all: ?php foreach(SettingPeer::getIndex() as $oSetting): ? ?php echo $oSetting-getSlug() . ': ' . $oSetting-getValue() ? ?php endforeach; ? But the error I receive says No connection information in your runtime configuration file for datasource [propel] What should I do to make this happen? Thanks! -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] Re: Use database in app.yml
Why not modify app.yml from your code, instead of using a database? On Jul 4, 10:08 pm, HAUSa jeroen_heeft_behoefte_aan_r...@hotmail.com wrote: I want to use this because I have some system setting which should really belong in that app.yml file. But the admins which I am developing it for want to change those settings in an admin panel. Think for example the lifetime of a post, how many credits for a quick respons / answer, etc. All settings I want to access by using sfConfig::get() The use op PHP in app.yml is possible I've seen, the only thing missing is the database connection. No connection information in your runtime configuration file for datasource [propel] How can I get that connection there? On 2 jul, 12:29, Daniel Lohse annismcken...@googlemail.com wrote: I'd probably go with a plugin that handles dynamic and configurable settings that live in a database, like csSettingsPlugin. :) Cheers, Daniel On 02.07.2010, at 11:41, Tom Ptacnik wrote: I'm not sure it's possible to do it this way. Why do you want to insert some configuration into the app.yml from database? For what do you need this configuration setting? On 1 čnc, 14:51, HAUSa jeroen_heeft_behoefte_aan_r...@hotmail.com wrote: I want to use some configuration settings from the database in my app.yml configuration file. This is my code now: all: ?php foreach(SettingPeer::getIndex() as $oSetting): ? ?php echo $oSetting-getSlug() . ': ' . $oSetting-getValue() ? ?php endforeach; ? But the error I receive says No connection information in your runtime configuration file for datasource [propel] What should I do to make this happen? Thanks! -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] Re: Use database in app.yml
I want to use this because I have some system setting which should really belong in that app.yml file. But the admins which I am developing it for want to change those settings in an admin panel. Think for example the lifetime of a post, how many credits for a quick respons / answer, etc. All settings I want to access by using sfConfig::get() The use op PHP in app.yml is possible I've seen, the only thing missing is the database connection. No connection information in your runtime configuration file for datasource [propel] How can I get that connection there? On 2 jul, 12:29, Daniel Lohse annismcken...@googlemail.com wrote: I'd probably go with a plugin that handles dynamic and configurable settings that live in a database, like csSettingsPlugin. :) Cheers, Daniel On 02.07.2010, at 11:41, Tom Ptacnik wrote: I'm not sure it's possible to do it this way. Why do you want to insert some configuration into the app.yml from database? For what do you need this configuration setting? On 1 čnc, 14:51, HAUSa jeroen_heeft_behoefte_aan_r...@hotmail.com wrote: I want to use some configuration settings from the database in my app.yml configuration file. This is my code now: all: ?php foreach(SettingPeer::getIndex() as $oSetting): ? ?php echo $oSetting-getSlug() . ': ' . $oSetting-getValue() ? ?php endforeach; ? But the error I receive says No connection information in your runtime configuration file for datasource [propel] What should I do to make this happen? Thanks! -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] Re: Use database in app.yml
I'm not sure it's possible to do it this way. Why do you want to insert some configuration into the app.yml from database? For what do you need this configuration setting? On 1 čnc, 14:51, HAUSa jeroen_heeft_behoefte_aan_r...@hotmail.com wrote: I want to use some configuration settings from the database in my app.yml configuration file. This is my code now: all: ?php foreach(SettingPeer::getIndex() as $oSetting): ? ?php echo $oSetting-getSlug() . ': ' . $oSetting-getValue() ? ?php endforeach; ? But the error I receive says No connection information in your runtime configuration file for datasource [propel] What should I do to make this happen? Thanks! -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
Re: [symfony-users] Re: Use database in app.yml
I'd probably go with a plugin that handles dynamic and configurable settings that live in a database, like csSettingsPlugin. :) Cheers, Daniel On 02.07.2010, at 11:41, Tom Ptacnik wrote: I'm not sure it's possible to do it this way. Why do you want to insert some configuration into the app.yml from database? For what do you need this configuration setting? On 1 čnc, 14:51, HAUSa jeroen_heeft_behoefte_aan_r...@hotmail.com wrote: I want to use some configuration settings from the database in my app.yml configuration file. This is my code now: all: ?php foreach(SettingPeer::getIndex() as $oSetting): ? ?php echo $oSetting-getSlug() . ': ' . $oSetting-getValue() ? ?php endforeach; ? But the error I receive says No connection information in your runtime configuration file for datasource [propel] What should I do to make this happen? Thanks! -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en