/** * Listens for the context.load_factories event. By this time, all core * classes are loaded, and we can add any initialization which needs to * run after classes are loaded. * * @param sfEvent $event */ public function loadFactoriesListener(sfEvent $event) { // Create key cache for hs_hr_config values $ohrmConfigCache = new ohrmKeyValueCache('config', function () { $configService = new ConfigService(); return $configService->getAllValues(); }); sfContext::getInstance()->setOhrmConfigCache($ohrmConfigCache); // use csrf_secret from hs_hr_config (overrides value in settings.yml) $csrfSecret = $ohrmConfigCache->get('csrf_secret'); if (!empty($csrfSecret)) { sfForm::enableCSRFProtection($csrfSecret); } }