| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class sfPropel |
|---|
| 20 |
{ |
|---|
| 21 |
static protected |
|---|
| 22 |
$defaultCulture = 'en'; |
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
* Initialize symfony propel |
|---|
| 26 |
* |
|---|
| 27 |
* @param sfEventDispatcher $dispatcher |
|---|
| 28 |
* @param string $culture |
|---|
| 29 |
* |
|---|
| 30 |
* @deprecated Moved to {@link sfPropelPluginConfiguration} |
|---|
| 31 |
*/ |
|---|
| 32 |
static public function initialize(sfEventDispatcher $dispatcher, $culture = null) |
|---|
| 33 |
{ |
|---|
| 34 |
$dispatcher->notify(new sfEvent(__CLASS__, 'application.log', array(__METHOD__.'() has been deprecated. Please call sfPropel::setDefaultCulture() to set the culture.', 'priority' => sfLogger::NOTICE))); |
|---|
| 35 |
|
|---|
| 36 |
if (null !== $culture) |
|---|
| 37 |
{ |
|---|
| 38 |
self::setDefaultCulture($culture); |
|---|
| 39 |
} |
|---|
| 40 |
else if (class_exists('sfContext', false) && sfContext::hasInstance() && $user = sfContext::getInstance()->getUser()) |
|---|
| 41 |
{ |
|---|
| 42 |
self::setDefaultCulture($user->getCulture()); |
|---|
| 43 |
} |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
* Sets the default culture |
|---|
| 48 |
* |
|---|
| 49 |
* @param string $culture |
|---|
| 50 |
*/ |
|---|
| 51 |
static public function setDefaultCulture($culture) |
|---|
| 52 |
{ |
|---|
| 53 |
self::$defaultCulture = $culture; |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
* Return the default culture |
|---|
| 58 |
* |
|---|
| 59 |
* @return string the default culture |
|---|
| 60 |
*/ |
|---|
| 61 |
static public function getDefaultCulture() |
|---|
| 62 |
{ |
|---|
| 63 |
return self::$defaultCulture; |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
* Listens to the user.change_culture event. |
|---|
| 68 |
* |
|---|
| 69 |
* @param sfEvent An sfEvent instance |
|---|
| 70 |
* |
|---|
| 71 |
*/ |
|---|
| 72 |
static public function listenToChangeCultureEvent(sfEvent $event) |
|---|
| 73 |
{ |
|---|
| 74 |
self::setDefaultCulture($event['culture']); |
|---|
| 75 |
} |
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
* @deprecated Use Propel::importClass() instead |
|---|
| 79 |
*/ |
|---|
| 80 |
static public function import($path) |
|---|
| 81 |
{ |
|---|
| 82 |
return Propel::importClass($path); |
|---|
| 83 |
} |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
* @deprecated Use Propel::importClass() instead |
|---|
| 87 |
*/ |
|---|
| 88 |
static public function importClass($path) |
|---|
| 89 |
{ |
|---|
| 90 |
return Propel::importClass($path); |
|---|
| 91 |
} |
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
* Clears all instance pools. |
|---|
| 95 |
* |
|---|
| 96 |
* @deprecated Moved to {@link sfPropelPluginConfiguration} |
|---|
| 97 |
*/ |
|---|
| 98 |
static public function clearAllInstancePools() |
|---|
| 99 |
{ |
|---|
| 100 |
sfProjectConfiguration::getActive()->getPluginConfiguration('sfPropelPlugin')->clearAllInstancePools(); |
|---|
| 101 |
} |
|---|
| 102 |
} |
|---|
| 103 |
|
|---|