Skip to content

Commit 8633ecf

Browse files
committed
Merge pull request #6 from LExpress/remove-deprecated
Remove deprecated doctrine init and form file
2 parents 0aedde3 + e784bb7 commit 8633ecf

File tree

3 files changed

+16
-29
lines changed

3 files changed

+16
-29
lines changed

lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineDatabase.class.php

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,6 @@ public function initialize($parameters = array())
103103
$this->_doctrineConnection->addListener($this->profiler, 'symfony_profiler');
104104
}
105105

106-
// Invoke the configuration methods for the connection if they exist (deprecated in favor of the "doctrine.configure_connection" event)
107-
$method = sprintf('configureDoctrineConnection%s', ucwords($this->_doctrineConnection->getName()));
108-
109-
if (method_exists($configuration, 'configureDoctrineConnection') && ! method_exists($configuration, $method))
110-
{
111-
$configuration->configureDoctrineConnection($this->_doctrineConnection);
112-
}
113-
114-
if (method_exists($configuration, $method))
115-
{
116-
$configuration->$method($this->_doctrineConnection);
117-
}
118-
119106
$dispatcher->notify(new sfEvent($manager, 'doctrine.configure_connection', array('connection' => $this->_doctrineConnection, 'database' => $this)));
120107
}
121108

@@ -131,7 +118,7 @@ public function getDoctrineConnection()
131118

132119
/**
133120
* Returns the connection profiler.
134-
*
121+
*
135122
* @return sfDoctrineConnectionProfiler|null
136123
*/
137124
public function getProfiler()
@@ -160,9 +147,9 @@ public function shutdown()
160147
{
161148
$this->connection = null;
162149
}
163-
if ($this->_doctrineConnection !== null)
164-
{
165-
$this->_doctrineConnection->getManager()->closeConnection($this->_doctrineConnection);
150+
if ($this->_doctrineConnection !== null)
151+
{
152+
$this->_doctrineConnection->getManager()->closeConnection($this->_doctrineConnection);
166153
}
167154
}
168-
}
155+
}

lib/plugins/sfDoctrinePlugin/lib/form/sfFormDoctrine.class.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,6 @@ protected function saveFile($field, $filename = null, sfValidatedFile $file = nu
395395
{
396396
return $file->save($this->getObject()->$method($file));
397397
}
398-
else if (method_exists($this->getObject(), $method = sprintf('generate%sFilename', $field)))
399-
{
400-
// this non-camelized method name has been deprecated
401-
return $file->save($this->getObject()->$method($file));
402-
}
403398
else
404399
{
405400
return $file->save();

lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/ProjectConfiguration.class.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)