Skip to content
This repository
Newer
Older
100644 87 lines (74 sloc) 2.739 kb
534b96ce » fzaninotto
2010-09-22 Added files from symfony SVN repository, last updated on r30914
1 <?php
2
3 /**
4 * sfPropelPlugin configuration.
0ba5f543 » rozwell
2011-05-03 Removed trailing spaces
5 *
534b96ce » fzaninotto
2010-09-22 Added files from symfony SVN repository, last updated on r30914
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 */
5c4dc583 » willdurand
2011-08-09 s/sfPropel15Plugin/sfPropelORMPlugin/
11 class sfPropelORMPluginConfiguration extends sfPluginConfiguration
534b96ce » fzaninotto
2010-09-22 Added files from symfony SVN repository, last updated on r30914
12 {
13 /**
14 * @see sfPluginConfiguration
15 */
16 public function initialize()
17 {
18 sfConfig::set('sf_orm', 'propel');
afc6175f » lucasaba
2011-08-19 Made base changes to use sf_propel_path and sf_phing_path and separate
19 sfConfig::set('sf_phing_path', sfConfig::get('sf_lib_dir', '../../../lib').'/vendor/phing');
20 sfConfig::set('sf_propel_path', sfConfig::get('sf_lib_dir', '../../../lib').'/vendor/propel');
21 //This one because propel includes phing/.....php
22 sfConfig::set('sf_vendor_path', sfConfig::get('sf_lib_dir', '../../../lib').'/vendor');
23
24
534b96ce » fzaninotto
2010-09-22 Added files from symfony SVN repository, last updated on r30914
25 if (!sfConfig::get('sf_admin_module_web_dir'))
26 {
5c4dc583 » willdurand
2011-08-09 s/sfPropel15Plugin/sfPropelORMPlugin/
27 sfConfig::set('sf_admin_module_web_dir', '/sfPropelORMPlugin');
534b96ce » fzaninotto
2010-09-22 Added files from symfony SVN repository, last updated on r30914
28 }
29
30 sfToolkit::addIncludePath(array(
31 sfConfig::get('sf_root_dir'),
afc6175f » lucasaba
2011-08-19 Made base changes to use sf_propel_path and sf_phing_path and separate
32 sfConfig::get('sf_phing_path'),
33 sfConfig::get('sf_propel_runtime_path', sfConfig::get('sf_propel_path').'/runtime/lib'),
34 sfConfig::get('sf_propel_path'),
35 sfConfig::get('sf_vendor_path')
534b96ce » fzaninotto
2010-09-22 Added files from symfony SVN repository, last updated on r30914
36 ));
37
7ce456e6 » willdurand
2011-08-17 Fixed inclusion and require paths
38 require_once 'Propel.php';
534b96ce » fzaninotto
2010-09-22 Added files from symfony SVN repository, last updated on r30914
39
40 if (!Propel::isInit())
41 {
42 if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled'))
43 {
44 Propel::setLogger(new sfPropelLogger($this->dispatcher));
45 }
46
47 $propelConfiguration = new PropelConfiguration();
48 Propel::setConfiguration($propelConfiguration);
49
50 $this->dispatcher->notify(new sfEvent($propelConfiguration, 'propel.configure'));
51
52 Propel::initialize();
53 }
54
55 $this->dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent'));
56
57 if (sfConfig::get('sf_web_debug'))
58 {
59 $this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelPropel', 'listenToAddPanelEvent'));
60 }
61
62 if (sfConfig::get('sf_test'))
63 {
64 $this->dispatcher->connect('context.load_factories', array($this, 'clearAllInstancePools'));
65 }
66 }
67
68 /**
69 * Clears all instance pools.
0ba5f543 » rozwell
2011-05-03 Removed trailing spaces
70 *
534b96ce » fzaninotto
2010-09-22 Added files from symfony SVN repository, last updated on r30914
71 * This method is used to clear Propel's static instance pools between
72 * requests performed in functional tests.
73 */
74 public function clearAllInstancePools()
75 {
76 $finder = sfFinder::type('file')->name('*TableMap.php');
77 foreach ($finder->in($this->configuration->getModelDirs()) as $file)
78 {
79 $omClass = basename($file, 'TableMap.php');
80 if (class_exists($omClass) && is_subclass_of($omClass, 'BaseObject'))
81 {
82 $peer = constant($omClass.'::PEER');
83 call_user_func(array($peer, 'clearInstancePool'));
84 }
85 }
86 }
87 }
Something went wrong with that request. Please try again.