Author: david
Date: Mon Jul 30 16:18:35 2012
New Revision: 12007
Log:
Set user culture to get multiple cultures working
Modified:
trunk/lib/QubitFlatfileImport.class.php
trunk/lib/task/import/csvImportBaseTask.class.php
trunk/lib/task/import/csvImportTask.class.php
Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php Mon Jul 30 09:47:28 2012
(r12006)
+++ trunk/lib/QubitFlatfileImport.class.php Mon Jul 30 16:18:35 2012
(r12007)
@@ -27,6 +27,7 @@
*/
class QubitFlatfileImport
{
+ public $context; // optional sfContext
public $className; // optional class name of object to
create/save
public $errorLog; // optional location of error log file
public $rowsUntilProgressDisplay; // optional display progress every n rows
@@ -534,6 +535,12 @@
$this->object = new $this->className;
}
+ // Set current culture
+ if (isset($this->context))
+ {
+ $this->context->getUser()->setCulture($this->columnValue('culture'));
+ }
+
// disable nested set updating, if applicable to object type
if (property_exists(get_class($this->object),
'disableNestedSetUpdating'))
{
@@ -577,7 +584,7 @@
* @return void
*/
protected function rowProcessingBeforeObjectCreation($row)
- {
+ {
// process import columns that don't produce child data
$this->forEachRowColumn($row, function(&$self, $index, $columnName, $value)
{
Modified: trunk/lib/task/import/csvImportBaseTask.class.php
==============================================================================
--- trunk/lib/task/import/csvImportBaseTask.class.php Mon Jul 30 09:47:28
2012 (r12006)
+++ trunk/lib/task/import/csvImportBaseTask.class.php Mon Jul 30 16:18:35
2012 (r12007)
@@ -37,6 +37,9 @@
));
$this->addOptions(array(
+ new sfCommandOption('application', null,
sfCommandOption::PARAMETER_OPTIONAL, 'The application name', 'qubit'),
+ new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED,
'The environment', 'cli'),
+ new sfCommandOption('connection', null,
sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'),
new sfCommandOption('rows-until-update', null,
sfCommandOption::PARAMETER_OPTIONAL, 'Output total rows imported every n
rows.'),
new sfCommandOption('skip-rows', null,
sfCommandOption::PARAMETER_OPTIONAL, 'Skip n rows before importing.'),
new sfCommandOption('error-log', null,
sfCommandOption::PARAMETER_OPTIONAL, 'File to log errors to.')
Modified: trunk/lib/task/import/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvImportTask.class.php Mon Jul 30 09:47:28
2012 (r12006)
+++ trunk/lib/task/import/csvImportTask.class.php Mon Jul 30 16:18:35
2012 (r12007)
@@ -100,6 +100,9 @@
// Define import
$import = new QubitFlatfileImport(array(
+ /* Pass context */
+ 'context' => sfContext::createInstance($this->configuration),
+
/* What type of object are we importing? */
'className' => 'QubitInformationObject',
--
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.