Commit | Line | Data |
---|---|---|
695780d7 MW |
1 | <?php |
2 | namespace wcf\system\importer; | |
c2836ca3 | 3 | use wcf\data\comment\response\CommentResponseEditor; |
9c6a8f95 | 4 | use wcf\system\WCF; |
695780d7 MW |
5 | |
6 | /** | |
7 | * Imports comment responses. | |
8 | * | |
9 | * @author Marcel Werk | |
10 | * @copyright 2001-2013 WoltLab GmbH | |
11 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | |
12 | * @package com.woltlab.wcf | |
13 | * @subpackage system.importer | |
14 | * @category Community Framework | |
15 | */ | |
c2836ca3 MW |
16 | class AbstractCommentResponseImporter extends AbstractImporter { |
17 | /** | |
06355ec3 | 18 | * @see wcf\system\importer\AbstractImporter::$className |
c2836ca3 MW |
19 | */ |
20 | protected $className = 'wcf\data\comment\response\CommentResponse'; | |
21 | ||
695780d7 MW |
22 | /** |
23 | * object type name | |
06355ec3 | 24 | * @var string |
695780d7 MW |
25 | */ |
26 | protected $objectTypeName = ''; | |
27 | ||
28 | /** | |
06355ec3 | 29 | * @see wcf\system\importer\IImporter::import() |
695780d7 | 30 | */ |
6eb1d790 | 31 | public function import($oldID, array $data, array $additionalData = array()) { |
732a49db | 32 | $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']); |
695780d7 MW |
33 | |
34 | $data['commentID'] = ImportHandler::getInstance()->getNewID($this->objectTypeName, $data['commentID']); | |
e1ad68de | 35 | if (!$data['commentID']) return 0; |
695780d7 | 36 | |
c2836ca3 | 37 | $response = CommentResponseEditor::create($data); |
695780d7 | 38 | |
9c6a8f95 AE |
39 | // update parent comment |
40 | $sql = "UPDATE wcf".WCF_N."_comment | |
41 | SET responseIDs = ? | |
42 | WHERE commentID = ?"; | |
43 | $statement = WCF::getDB()->prepareStatement($sql); | |
44 | $statement->execute(array( | |
45 | serialize(array($response->responseID)), | |
46 | $response->commentID | |
47 | )); | |
48 | ||
c2836ca3 | 49 | return $response->responseID; |
695780d7 MW |
50 | } |
51 | } |