-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathDocuments.php
More file actions
80 lines (75 loc) · 2.42 KB
/
Documents.php
File metadata and controls
80 lines (75 loc) · 2.42 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
<?php
namespace Utopia\Database\Validator\Queries;
use Utopia\Database\Database;
use Utopia\Database\Document;
use Utopia\Database\Validator\IndexedQueries;
use Utopia\Database\Validator\Query\Cursor;
use Utopia\Database\Validator\Query\Filter;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\Query\Order;
use Utopia\Database\Validator\Query\Select;
class Documents extends IndexedQueries
{
/**
* @param array<mixed> $attributes
* @param array<mixed> $indexes
* @param string $idAttributeType
* @param int $maxValuesCount
* @param \DateTime $minAllowedDate
* @param \DateTime $maxAllowedDate
* @param bool $supportForAttributes
* @throws \Utopia\Database\Exception
*/
public function __construct(
array $attributes,
array $indexes,
string $idAttributeType,
int $maxValuesCount = 5000,
int $maxUIDLength = 36,
\DateTime $minAllowedDate = new \DateTime('0000-01-01'),
\DateTime $maxAllowedDate = new \DateTime('9999-12-31'),
bool $supportForAttributes = true
) {
$attributes[] = new Document([
'$id' => '$id',
'key' => '$id',
'type' => Database::VAR_STRING,
'array' => false,
]);
$attributes[] = new Document([
'$id' => '$sequence',
'key' => '$sequence',
'type' => Database::VAR_ID,
'array' => false,
]);
$attributes[] = new Document([
'$id' => '$createdAt',
'key' => '$createdAt',
'type' => Database::VAR_DATETIME,
'array' => false,
]);
$attributes[] = new Document([
'$id' => '$updatedAt',
'key' => '$updatedAt',
'type' => Database::VAR_DATETIME,
'array' => false,
]);
$validators = [
new Limit(),
new Offset(),
new Cursor($maxUIDLength),
new Filter(
$attributes,
$idAttributeType,
$maxValuesCount,
$minAllowedDate,
$maxAllowedDate,
$supportForAttributes
),
new Order($attributes, $supportForAttributes),
new Select($attributes, $supportForAttributes),
];
parent::__construct($attributes, $indexes, $validators);
}
}