From 303387f6931c69d5d12816dd45385271a76872cd Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 2 Aug 2013 00:58:37 +0200 Subject: [PATCH] Added category importer --- .../AbstractCategoryImporter.class.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/importer/AbstractCategoryImporter.class.php diff --git a/wcfsetup/install/files/lib/system/importer/AbstractCategoryImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractCategoryImporter.class.php new file mode 100644 index 0000000000..ed26c4faa7 --- /dev/null +++ b/wcfsetup/install/files/lib/system/importer/AbstractCategoryImporter.class.php @@ -0,0 +1,44 @@ + + * @package com.woltlab.wcf + * @subpackage system.importer + * @category Community Framework + */ +class AbstractCategoryImporter implements IImporter { + /** + * object type id for categories + * @var integer + */ + protected $objectTypeID = 0; + + /** + * object type name + * @var integer + */ + protected $objectTypeName = ''; + + /** + * @see wcf\system\importer\IImporter::import() + */ + public function import($oldID, array $data, array $additionalData = array()) { + if (!empty($data['parentCategoryID'])) $data['parentCategoryID'] = ImportHandler::getInstance()->getNewID($this->objectTypeName, $data['parentCategoryID']); + + $action = new CategoryAction(array(), 'create', array( + 'data' => array_merge($data, array('objectTypeID' => $this->objectTypeID)) + )); + $returnValues = $action->executeAction(); + $newID = $returnValues['returnValues']->categoryID; + + ImportHandler::getInstance()->saveNewID($this->objectTypeName, $oldID, $newID); + + return $newID; + } +} -- 2.20.1