Fix `Ui/Message/Manager.getPermission()` for permissions with dashes
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / database / table / column / IDatabaseTableColumn.class.php
CommitLineData
f6e43f2f
MS
1<?php
2namespace wcf\system\database\table\column;
3
4/**
5 * Represents a column of a database table.
6 *
7 * @author Matthias Schmidt
8 * @copyright 2001-2019 WoltLab GmbH
9 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
10 * @package WoltLabSuite\Core\System\Database\Table\Column
11 * @since 5.2
12 */
13interface IDatabaseTableColumn {
14 /**
15 * Sets the default value of the column and returns the column.
16 *
17 * @param mixed $defaultValue
18 * @return $this
19 */
20 public function defaultValue($defaultValue);
21
22 /**
23 * Marks the column to be dropped and returns the column.
24 *
25 * @return $this
26 */
27 public function drop();
28
29 /**
30 * Returns the data used by `DatabaseEditor` to add the column to a table.
31 *
32 * @return array
33 */
34 public function getData();
35
36 /**
37 * Returns the default value of the column.
38 *
39 * @return $this
40 */
41 public function getDefaultValue();
42
43 /**
44 * Returns the name of the column.
45 *
46 * @return string
47 */
48 public function getName();
49
1a024c65
MS
50 /**
51 * Returns the new name of the column or `null` if the column's name is unchanged.
52 *
53 * @since 5.4
54 */
55 public function getNewName(): ?string;
56
f6e43f2f
MS
57 /**
58 * Returns the type of the column.
59 *
60 * @return string
61 */
62 public function getType();
63
64 /**
65 * Returns `true` if the values of the column cannot be `null`.
66 *
67 * @return bool
68 */
69 public function isNotNull();
70
71 /**
72 * Sets the name of the column and returns the column.
73 *
74 * @param string $name
75 * @return $this
76 */
77 public function name($name);
78
79 /**
80 * Sets if the values of the column cannot be `null`.
81 *
82 * @param bool $notNull
83 * @return $this
84 */
85 public function notNull($notNull = true);
86
1a024c65
MS
87 /**
88 * Sets the new name of the column and returns the column.
89 *
90 * @since 5.4
91 */
92 public function renameTo(string $newName): self;
93
f6e43f2f
MS
94 /**
95 * Returns `true` if the column will be dropped.
96 *
97 * @return bool
98 */
99 public function willBeDropped();
100
101 /**
102 * Returns a `DatabaseTableColumn` object with the given name.
103 *
104 * @param string $name
105 * @return $this
106 */
107 public static function create($name);
108
109 /**
110 * Returns a `DatabaseTableColumn` object with the given name and data.
111 *
112 * @param string $name
113 * @param array $data data returned by `DatabaseEditor::getColumns()`
114 * @return $this
115 */
116 public static function createFromData($name, array $data);
117}