Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 82 lines (69 sloc) 2.312 kb
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
1 <?php
2
3 /**
4 * sfPropelPlugin configuration.
0ba5f54 Removed trailing spaces
rozwell authored
5 *
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
6 * @package sfPropelPlugin
7 * @subpackage config
8 * @author Fabien Potencier <fabien.potencier@symfony-project.com>
9 * @version SVN: $Id: sfPropelPluginConfiguration.class.php 23739 2009-11-09 23:32:46Z Kris.Wallsmith $
10 */
5c4dc58 William Durand s/sfPropel15Plugin/sfPropelORMPlugin/
willdurand authored
11 class sfPropelORMPluginConfiguration extends sfPluginConfiguration
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
12 {
13 /**
14 * @see sfPluginConfiguration
15 */
16 public function initialize()
17 {
18 sfConfig::set('sf_orm', 'propel');
2b0b134 William Durand Removed trailing whitespaces
willdurand authored
19
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
20 if (!sfConfig::get('sf_admin_module_web_dir'))
21 {
5c4dc58 William Durand s/sfPropel15Plugin/sfPropelORMPlugin/
willdurand authored
22 sfConfig::set('sf_admin_module_web_dir', '/sfPropelORMPlugin');
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
23 }
2b0b134 William Durand Removed trailing whitespaces
willdurand authored
24
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
25 sfToolkit::addIncludePath(array(
26 sfConfig::get('sf_root_dir'),
afc6175 Luca Saba Made base changes to use sf_propel_path and sf_phing_path and separate
lucasaba authored
27 sfConfig::get('sf_phing_path'),
28 sfConfig::get('sf_propel_path'),
a3edbd5 Luca Saba Ads cleanliness to the code
lucasaba authored
29 sfConfig::get('sf_phing_path').'/../',
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
30 ));
2b0b134 William Durand Removed trailing whitespaces
willdurand authored
31
a3edbd5 Luca Saba Ads cleanliness to the code
lucasaba authored
32 require_once 'runtime/lib/Propel.php';
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
33
34 if (!Propel::isInit())
35 {
36 if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled'))
37 {
38 Propel::setLogger(new sfPropelLogger($this->dispatcher));
39 }
40
41 $propelConfiguration = new PropelConfiguration();
42 Propel::setConfiguration($propelConfiguration);
43
44 $this->dispatcher->notify(new sfEvent($propelConfiguration, 'propel.configure'));
45
46 Propel::initialize();
47 }
48
49 $this->dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent'));
50
51 if (sfConfig::get('sf_web_debug'))
52 {
53 $this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelPropel', 'listenToAddPanelEvent'));
54 }
55
56 if (sfConfig::get('sf_test'))
57 {
58 $this->dispatcher->connect('context.load_factories', array($this, 'clearAllInstancePools'));
59 }
60 }
61
62 /**
63 * Clears all instance pools.
0ba5f54 Removed trailing spaces
rozwell authored
64 *
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
65 * This method is used to clear Propel's static instance pools between
66 * requests performed in functional tests.
67 */
68 public function clearAllInstancePools()
69 {
70 $finder = sfFinder::type('file')->name('*TableMap.php');
71 foreach ($finder->in($this->configuration->getModelDirs()) as $file)
72 {
73 $omClass = basename($file, 'TableMap.php');
74 if (class_exists($omClass) && is_subclass_of($omClass, 'BaseObject'))
75 {
76 $peer = constant($omClass.'::PEER');
77 call_user_func(array($peer, 'clearInstancePool'));
78 }
79 }
80 }
81 }
Something went wrong with that request. Please try again.