@@ -8,6 +8,9 @@ class ProjectConfiguration extends sfProjectConfiguration
88 public function setup ()
99 {
1010 $ this ->enableAllPluginsExcept ();
11+
12+ $ this ->dispatcher ->connect ('doctrine.configure ' , array ($ this , 'configureDoctrineEvent ' ));
13+ $ this ->dispatcher ->connect ('doctrine.configure_connection ' , array ($ this , 'configureDoctrineConnectionEvent ' ));
1114 }
1215
1316 public function initializeDoctrine ()
@@ -37,20 +40,22 @@ public function loadFixtures($fixtures)
3740 $ task ->run (array ($ path ));
3841 }
3942
40- public function configureDoctrine ( Doctrine_Manager $ manager )
43+ public function configureDoctrineEvent ( sfEvent $ event )
4144 {
45+ $ manager = $ event ->getSubject ();
4246 $ manager ->setAttribute (Doctrine_Core::ATTR_VALIDATE , true );
4347
4448 $ options = array ('baseClassName ' => 'myDoctrineRecord ' );
4549 sfConfig::set ('doctrine_model_builder_options ' , $ options );
4650 }
4751
48- public function configureDoctrineConnection ( Doctrine_Connection $ connection )
52+ public function configureDoctrineConnectionEvent ( sfEvent $ event )
4953 {
50- }
54+ $ parameters = $ event -> getParameters ();
5155
52- public function configureDoctrineConnectionDoctrine2 (Doctrine_Connection $ connection )
53- {
54- $ connection ->setAttribute (Doctrine_Core::ATTR_VALIDATE , false );
56+ if ('doctrine2 ' === $ parameters ['connection ' ]->getName ())
57+ {
58+ $ parameters ['connection ' ]->setAttribute (Doctrine_Core::ATTR_VALIDATE , false );
59+ }
5560 }
5661}
0 commit comments