Author: mcantelon Date: Tue Jan 17 11:29:52 2012 New Revision: 10695 Log: Added import subdir to put in import-related tasks.
Added: trunk/lib/task/import/ Modified: trunk/lib/task/csvImportTask.class.php Modified: trunk/lib/task/csvImportTask.class.php ============================================================================== --- trunk/lib/task/csvImportTask.class.php Tue Jan 17 00:03:27 2012 (r10694) +++ trunk/lib/task/csvImportTask.class.php Tue Jan 17 11:29:52 2012 (r10695) @@ -25,50 +25,15 @@ * @author Mike Cantelon <[email protected]> * @version SVN: $Id$ */ -class csvImportTask extends sfBaseTask +class csvImportTask extends csvImportBaseTask { - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments(array( - new sfCommandArgument('filename', sfCommandArgument::REQUIRED, 'The input file (csv format).') - )); + protected $namespace = 'csv'; + protected $name = 'import'; + protected $briefDescription = 'Import csv information object data'; - $this->addOptions(array( - 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.'), - new sfCommandOption('source-name', null, sfCommandOption::PARAMETER_OPTIONAL, 'Source name to use when inserting keymap entries.') - )); - - $this->namespace = 'csv'; - $this->name = 'import'; - $this->briefDescription = 'Import csv information object data'; - - $this->detailedDescription = <<<EOF + protected $detailedDescription = <<<EOF Import CSV data EOF; - } - - protected function validateOptions($options) - { - $numericOptions = array('rows-until-update', 'skip-rows'); - - foreach($numericOptions as $option) - { - if ($options[$option] && !is_numeric($options[$option])) - { - throw new sfException($option .' must be an integer'); - } - } - - if ($options['error-log'] && !is_dir(dirname($options['error-log']))) - { - throw new sfException('Path to error log is invalid.'); - } - } /** * @see sfTask -- 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.
