Replace @see tags with @inheritDoc tags
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / package / plugin / ObjectTypeDefinitionPackageInstallationPlugin.class.php
CommitLineData
7fcc7676
MW
1<?php
2namespace wcf\system\package\plugin;
3use wcf\system\WCF;
4
5/**
a17de04e 6 * Installs, updates and deletes object type definitions.
7fcc7676
MW
7 *
8 * @author Alexander Ebert
7d739af0 9 * @copyright 2001-2016 WoltLab GmbH
7fcc7676
MW
10 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
11 * @package com.woltlab.wcf
12 * @subpackage acp.package.plugin
9f959ced 13 * @category Community Framework
7fcc7676
MW
14 */
15class ObjectTypeDefinitionPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin {
16 /**
0fcfe5f6 17 * @inheritDoc
7fcc7676
MW
18 */
19 public $className = 'wcf\data\object\type\definition\ObjectTypeDefinitionEditor';
20
7fcc7676 21 /**
0fcfe5f6 22 * @inheritDoc
9f959ced 23 */
7fcc7676
MW
24 public $tagName = 'definition';
25
26 /**
0fcfe5f6 27 * @inheritDoc
7fcc7676
MW
28 */
29 protected function handleDelete(array $items) {
30 $sql = "DELETE FROM wcf".WCF_N."_".$this->tableName."
31 WHERE definitionName = ?
32 AND packageID = ?";
33 $statement = WCF::getDB()->prepareStatement($sql);
34 foreach ($items as $item) {
058cbd6a 35 $statement->execute([
7fcc7676
MW
36 $item['attributes']['name'],
37 $this->installation->getPackageID()
058cbd6a 38 ]);
7fcc7676
MW
39 }
40 }
41
42 /**
0fcfe5f6 43 * @inheritDoc
7fcc7676
MW
44 */
45 protected function prepareImport(array $data) {
058cbd6a 46 return [
7fcc7676 47 'interfaceName' => (isset($data['elements']['interfacename']) ? $data['elements']['interfacename'] : ''),
16bd0d85
AE
48 'definitionName' => $data['elements']['name'],
49 'categoryName' => (isset($data['elements']['categoryname']) ? $data['elements']['categoryname'] : '')
058cbd6a 50 ];
7fcc7676
MW
51 }
52
53 /**
0fcfe5f6 54 * @inheritDoc
7fcc7676
MW
55 */
56 protected function findExistingItem(array $data) {
57 $sql = "SELECT *
58 FROM wcf".WCF_N."_".$this->tableName."
c404ff5f 59 WHERE definitionName = ?";
058cbd6a 60 $parameters = [$data['definitionName']];
7fcc7676 61
058cbd6a 62 return [
7fcc7676
MW
63 'sql' => $sql,
64 'parameters' => $parameters
058cbd6a 65 ];
7fcc7676
MW
66 }
67}