-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMediumText.php
More file actions
97 lines (90 loc) · 2.4 KB
/
MediumText.php
File metadata and controls
97 lines (90 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
namespace Utopia\Migration\Resources\Database\Columns;
use Utopia\Database\Database;
use Utopia\Migration\Resources\Database\Column;
use Utopia\Migration\Resources\Database\Table;
class MediumText extends Column
{
public function __construct(
string $key,
Table $table,
bool $required = false,
?string $default = null,
bool $array = false,
int $size = 16777215,
string $format = '',
string $createdAt = '',
string $updatedAt = ''
) {
parent::__construct(
$key,
$table,
size: $size,
required: $required,
default: $default,
array: $array,
format: $format,
createdAt: $createdAt,
updatedAt: $updatedAt
);
}
/**
* @param array{
* key: string,
* collection?: array{
* database: array{
* id: string,
* name: string,
* },
* name: string,
* id: string,
* documentSecurity: bool,
* permissions: ?array<string>
* },
* table?: array{
* database: array{
* id: string,
* name: string,
* },
* name: string,
* id: string,
* rowSecurity: bool,
* permissions: ?array<string>
* },
* required: bool,
* default: ?string,
* array: bool,
* size: int,
* format: string,
* createdAt: string,
* updatedAt: string,
* } $array
* @return self
*/
public static function fromArray(array $array): self
{
return new self(
$array['key'],
Table::fromArray($array['table'] ?? $array['collection']),
required: $array['required'],
default: $array['default'] ?? null,
array: $array['array'],
size: $array['size'],
format: $array['format'],
createdAt: $array['createdAt'] ?? '',
updatedAt: $array['updatedAt'] ?? '',
);
}
public function getType(): string
{
return Column::TYPE_MEDIUMTEXT;
}
public function getSize(): int
{
return $this->size;
}
public function getFormat(): string
{
return $this->format;
}
}