Author: mcantelon
Date: Tue Jan 10 17:02:22 2012
New Revision: 10641
Log:
Separated rowComplete import logic into preSaveLogic and postSaveLogic.
Modified:
trunk/lib/QubitFlatfileImport.class.php
trunk/lib/task/csvImportTask.class.php
Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php Tue Jan 10 16:53:56 2012
(r10640)
+++ trunk/lib/QubitFlatfileImport.class.php Tue Jan 10 17:02:22 2012
(r10641)
@@ -46,7 +46,8 @@
'defaultStatusTypeId',
'testing',
'rowInit',
- 'rowComplete',
+ 'preSaveLogic',
+ 'postSaveLogic',
'propertyMap',
'noteMap',
'columnMap',
@@ -381,8 +382,19 @@
// set fields in information object and execute custom column handlers
$this->rowProcessingBeforeSave($row);
+ // execute pre-save ad-hoc import logic
+ $this->executeClosurePropertyIfSet('preSaveLogic');
+
+ // if not in testing mode, save object
+ if (!isset($this->testing) || !$this->testing)
+ {
+ $this->informationObject->save();
+ }
+
// execute row completion logic
- $this->executeClosurePropertyIfSet('rowComplete');
+ $this->executeClosurePropertyIfSet('postSaveLogic');
+
+ // execute post-save ad-hoc import logic
// process import columns that produce child data (properties and notes)
$this->rowProcessingAfterSave($row);
Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php Tue Jan 10 16:53:56 2012
(r10640)
+++ trunk/lib/task/csvImportTask.class.php Tue Jan 10 17:02:22 2012
(r10641)
@@ -241,7 +241,8 @@
{
$self->informationObject = new QubitInformationObject;
},
- 'rowComplete' => function(&$self)
+ /* import logic to execute before saving information object */
+ 'preSaveLogic' => function(&$self)
{
// set to default status
$self->informationObject->setStatus(array(
@@ -267,12 +268,10 @@
}
$self->informationObject->parentId = $parentId;
-
- if (!isset($self->testing) || !$self->testing)
- {
- $self->informationObject->save();
- }
-
+ },
+ /* import logic to execute after saving information object */
+ 'postSaveLogic' => function(&$self)
+ {
if (!$self->informationObject->id)
{
throw new sfException('Information object save failed');
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" 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/qubit-commits?hl=en.