Author: francois
Date: 2010-04-13 13:03:44 +0200 (Tue, 13 Apr 2010)
New Revision: 29100
Modified:
plugins/sfPropel15Plugin/trunk/lib/addon/sfPropelData.class.php
plugins/sfPropel15Plugin/trunk/lib/task/sfPropelDataLoadTask.class.php
plugins/sfPropel15Plugin/trunk/package.xml.tmpl
Log:
[sfPropel15Plugin] Added detailed logs to propel:data-load task
Modified: plugins/sfPropel15Plugin/trunk/lib/addon/sfPropelData.class.php
===================================================================
--- plugins/sfPropel15Plugin/trunk/lib/addon/sfPropelData.class.php
2010-04-13 10:32:26 UTC (rev 29099)
+++ plugins/sfPropel15Plugin/trunk/lib/addon/sfPropelData.class.php
2010-04-13 11:03:44 UTC (rev 29100)
@@ -21,9 +21,31 @@
{
protected
$deletedClasses = array(),
- $con = null;
+ $con = null,
+ $dispatcher = null,
+ $formatter = null;
/**
+ * Initializes the sfPropelData instance.
+ *
+ * @param sfEventDispatcher $dispatcher A sfEventDispatcher instance
+ * @param sfFormatter $formatter A sfFormatter instance
+ */
+ public function initialize(sfEventDispatcher $dispatcher, sfFormatter
$formatter)
+ {
+ $this->dispatcher = $dispatcher;
+ $this->formatter = $formatter;
+ }
+
+ public function log($message, $size = null, $style = 'INFO')
+ {
+ if ($this->dispatcher instanceof sfEventDispatcher)
+ {
+ $this->dispatcher->notify(new sfEvent($this, 'command.log',
array($this->formatter->formatSection('Propel', $message, $size, $style))));
+ }
+ }
+
+ /**
* Loads data from a file or directory into a Propel data source
*
* @see sfPropelData::loadData()
@@ -61,6 +83,17 @@
}
/**
+ * Loads data for the database from a YAML file
+ *
+ * @param string $file The path to the YAML file.
+ */
+ protected function doLoadDataFromFile($file)
+ {
+ $this->log(sprintf('reading data from %s', $file));
+ parent::doLoadDataFromFile($file);
+ }
+
+ /**
* Implements the abstract loadDataFromArray method and loads the data using
the generated data model.
*
* @param array $data The data to be loaded into the data source
@@ -254,7 +287,8 @@
{
throw new InvalidArgumentException(sprintf('Unknown class
"%sPeer".', $class));
}
-
+
+ $this->log(sprintf('deleting data from %s', $class));
call_user_func(array(constant($class.'::PEER'), 'doDeleteAll'),
$this->con);
$this->deletedClasses[] = $class;
Modified: plugins/sfPropel15Plugin/trunk/lib/task/sfPropelDataLoadTask.class.php
===================================================================
--- plugins/sfPropel15Plugin/trunk/lib/task/sfPropelDataLoadTask.class.php
2010-04-13 10:32:26 UTC (rev 29099)
+++ plugins/sfPropel15Plugin/trunk/lib/task/sfPropelDataLoadTask.class.php
2010-04-13 11:03:44 UTC (rev 29100)
@@ -86,6 +86,7 @@
}
$data = new sfPropelData();
+ $data->initialize($this->dispatcher, $this->formatter);
$data->setDeleteCurrentData(!$options['append']);
$dirs = array();
Modified: plugins/sfPropel15Plugin/trunk/package.xml.tmpl
===================================================================
--- plugins/sfPropel15Plugin/trunk/package.xml.tmpl 2010-04-13 10:32:26 UTC
(rev 29099)
+++ plugins/sfPropel15Plugin/trunk/package.xml.tmpl 2010-04-13 11:03:44 UTC
(rev 29100)
@@ -45,6 +45,22 @@
<changelog>
<release>
<version>
+ <release>0.9.1</release>
+ <api>1.5</api>
+ </version>
+ <stability>
+ <release>beta</release>
+ <api>beta</api>
+ </stability>
+ <license uri="http://www.symfony-project.org/license">MIT
license</license>
+ <date></date>
+ <license>MIT</license>
+ <notes>
+ * Added detailed logs to propel:data-load task
+ </notes>
+ </release>
+ <release>
+ <version>
<release>0.9.0</release>
<api>1.5</api>
</version>
--
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.