コード例 #1
0
ファイル: sfPropel.class.php プロジェクト: ajith24/ajithworld
 public static function initialize(sfEventDispatcher $dispatcher, $culture = null)
 {
     $dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent'));
     if (!is_null($culture)) {
         self::setDefaultCulture($culture);
     } else {
         if (class_exists('sfContext', false) && sfContext::hasInstance() && ($user = sfContext::getInstance()->getUser())) {
             self::setDefaultCulture($user->getCulture());
         }
     }
     self::$initialized = true;
 }
コード例 #2
0
ファイル: sfPropel.class.php プロジェクト: yasirgit/afids
 /**
  * Initialize sfymfony propel
  *
  * @param sfEventDispatcher $dispatcher
  * @param string $culture
  */
 public static function initialize(sfEventDispatcher $dispatcher, $culture = null)
 {
     if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
         // add propel logger
         Propel::setLogger(new sfPropelLogger($dispatcher));
     }
     // propel initialization
     $configuration = sfPropelDatabase::getConfiguration();
     if ($configuration) {
         Propel::setConfiguration($configuration);
         if (!Propel::isInit()) {
             Propel::initialize();
         }
     }
     $dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent'));
     if (!is_null($culture)) {
         self::setDefaultCulture($culture);
     } else {
         if (class_exists('sfContext', false) && sfContext::hasInstance() && ($user = sfContext::getInstance()->getUser())) {
             self::setDefaultCulture($user->getCulture());
         }
     }
     self::$initialized = true;
 }