Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 93 lines (78 sloc) 2.67 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
d77224e William Durand Fixed default parameters
willdurand authored
25 if (false === sfConfig::get('sf_phing_path'))
26 {
27 sfConfig::set('sf_phing_path', realpath(dirname(__FILE__).'/../lib/vendor/phing'));
28 }
29
30 if (false === sfConfig::get('sf_propel_path'))
31 {
32 sfConfig::set('sf_propel_path', realpath(dirname(__FILE__).'/../lib/vendor/propel'));
33 }
34
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
35 sfToolkit::addIncludePath(array(
36 sfConfig::get('sf_root_dir'),
afc6175 Luca Saba Made base changes to use sf_propel_path and sf_phing_path and separate
lucasaba authored
37 sfConfig::get('sf_phing_path'),
38 sfConfig::get('sf_propel_path'),
a3edbd5 Luca Saba Ads cleanliness to the code
lucasaba authored
39 sfConfig::get('sf_phing_path').'/../',
059da3e William Durand Fixed tests
willdurand authored
40 sfConfig::get('sf_phing_path').'/classes',
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
41 ));
2b0b134 William Durand Removed trailing whitespaces
willdurand authored
42
a3edbd5 Luca Saba Ads cleanliness to the code
lucasaba authored
43 require_once 'runtime/lib/Propel.php';
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
44
45 if (!Propel::isInit())
46 {
47 if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled'))
48 {
49 Propel::setLogger(new sfPropelLogger($this->dispatcher));
50 }
51
52 $propelConfiguration = new PropelConfiguration();
53 Propel::setConfiguration($propelConfiguration);
54
55 $this->dispatcher->notify(new sfEvent($propelConfiguration, 'propel.configure'));
56
57 Propel::initialize();
58 }
59
60 $this->dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent'));
61
62 if (sfConfig::get('sf_web_debug'))
63 {
64 $this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelPropel', 'listenToAddPanelEvent'));
65 }
66
67 if (sfConfig::get('sf_test'))
68 {
69 $this->dispatcher->connect('context.load_factories', array($this, 'clearAllInstancePools'));
70 }
71 }
72
73 /**
74 * Clears all instance pools.
0ba5f54 Removed trailing spaces
rozwell authored
75 *
534b96c Francois Zaninotto Added files from symfony SVN repository, last updated on r30914
fzaninotto authored
76 * This method is used to clear Propel's static instance pools between
77 * requests performed in functional tests.
78 */
79 public function clearAllInstancePools()
80 {
81 $finder = sfFinder::type('file')->name('*TableMap.php');
82 foreach ($finder->in($this->configuration->getModelDirs()) as $file)
83 {
84 $omClass = basename($file, 'TableMap.php');
85 if (class_exists($omClass) && is_subclass_of($omClass, 'BaseObject'))
86 {
87 $peer = constant($omClass.'::PEER');
88 call_user_func(array($peer, 'clearInstancePool'));
89 }
90 }
91 }
92 }
Something went wrong with that request. Please try again.