Author: maksim_ka
Date: 2010-02-03 09:36:54 +0100 (Wed, 03 Feb 2010)
New Revision: 27471
Modified:
plugins/sfPhpunitPlugin/branches/1.4/lib/fixture/data/sfPhpunitDoctrineData.php
plugins/sfPhpunitPlugin/branches/1.4/lib/fixture/sfPhpunitFixtureDoctrine.php
Log:
[sfPhpunitPlugin][sf1.4] migrate fixture code to support new Doctrine that
bundled with sf1.4
Modified:
plugins/sfPhpunitPlugin/branches/1.4/lib/fixture/data/sfPhpunitDoctrineData.php
===================================================================
---
plugins/sfPhpunitPlugin/branches/1.4/lib/fixture/data/sfPhpunitDoctrineData.php
2010-02-03 08:31:17 UTC (rev 27470)
+++
plugins/sfPhpunitPlugin/branches/1.4/lib/fixture/data/sfPhpunitDoctrineData.php
2010-02-03 08:36:54 UTC (rev 27471)
@@ -7,14 +7,15 @@
* @see
plugins/sfPhpunitPlugin/lib/fixture/data/sfPhpunitDataInterface#getObject($id,
$class)
*/
public function getObject($id)
- {
+ {
if (strpos($id, '_') === false) {
- throw new Exception('The id should match the pattern {class}_{id}
but you provide: `'.$id.'`');
+ throw new Exception('The id should match the pattern {table}_{id}
but you provide: `'.$id.'`');
}
- list($table, $id) = explode('_', $id, 2);
- $id = '('.strtolower($table).') '.strtolower($id);
-
+ list($class, $id) = explode('_', $id, 2);
+ $table = Doctrine_Core::getTable($class)->getTableName();
+ $id = '('.strtolower($table).') '.$id;
+
return isset($this->_importedObjects[$id]) ?
$this->_importedObjects[$id] : null;
}
Modified:
plugins/sfPhpunitPlugin/branches/1.4/lib/fixture/sfPhpunitFixtureDoctrine.php
===================================================================
---
plugins/sfPhpunitPlugin/branches/1.4/lib/fixture/sfPhpunitFixtureDoctrine.php
2010-02-03 08:31:17 UTC (rev 27470)
+++
plugins/sfPhpunitPlugin/branches/1.4/lib/fixture/sfPhpunitFixtureDoctrine.php
2010-02-03 08:36:54 UTC (rev 27471)
@@ -56,12 +56,24 @@
{
$this->_getDataLoader()->cleanObjects();
- $rebuild = new sfDoctrineRebuildDbTask(new sfEventDispatcher, new
sfFormatter);
- $rebuild->run(array(), array(
+ $task = new sfDoctrineDropDbTask(new sfEventDispatcher, new sfFormatter);
+ $task->run(array(), array(
'no-confirmation' => true,
'application' => $this->_getApp(),
'env' => $this->_getEnv()
));
+
+ $task = new sfDoctrineBuildDbTask(new sfEventDispatcher, new sfFormatter);
+ $task->run(array(), array(
+ 'application' => $this->_getApp(),
+ 'env' => $this->_getEnv()
+ ));
+
+ $task = new sfDoctrineInsertSqlTask(new sfEventDispatcher, new
sfFormatter);
+ $task->run(array(), array(
+ 'application' => $this->_getApp(),
+ 'env' => $this->_getEnv()
+ ));
return $this;
}
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.