Skip to content

Commit fafacee

Browse files
updated
1 parent 946b841 commit fafacee

1 file changed

Lines changed: 0 additions & 40 deletions

File tree

src/Database/Database.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,6 @@ public function updateCollection(string $id, array $permissions, bool $documentS
19061906
public function getCollection(string $id): Document
19071907
{
19081908
$collection = $this->silent(fn () => $this->getDocument(self::METADATA, $id));
1909-
$collection = $this->normalizeCollectionAttributeSizes($collection);
19101909

19111910
if (
19121911
$id !== self::METADATA
@@ -1942,8 +1941,6 @@ public function listCollections(int $limit = 25, int $offset = 0): array
19421941
Query::offset($offset)
19431942
]));
19441943

1945-
$result = \array_map(fn (Document $collection) => $this->normalizeCollectionAttributeSizes($collection), $result);
1946-
19471944
try {
19481945
$this->trigger(self::EVENT_COLLECTION_LIST, $result);
19491946
} catch (\Throwable $e) {
@@ -1953,43 +1950,6 @@ public function listCollections(int $limit = 25, int $offset = 0): array
19531950
return $result;
19541951
}
19551952

1956-
private function normalizeCollectionAttributeSizes(Document $collection): Document
1957-
{
1958-
if ($collection->isEmpty()) {
1959-
return $collection;
1960-
}
1961-
1962-
$attributes = $collection->getAttribute('attributes', []);
1963-
if (!\is_array($attributes)) {
1964-
return $collection;
1965-
}
1966-
1967-
foreach ($attributes as $attribute) {
1968-
if (!$attribute instanceof Document) {
1969-
continue;
1970-
}
1971-
1972-
$type = $attribute->getAttribute('type');
1973-
1974-
if ($type === self::VAR_BIGINT) {
1975-
$formatOptions = $attribute->getAttribute('formatOptions', []);
1976-
if (\is_array($formatOptions)) {
1977-
if (\array_key_exists('min', $formatOptions) && $formatOptions['min'] !== null) {
1978-
$formatOptions['min'] = (string)$formatOptions['min'];
1979-
}
1980-
if (\array_key_exists('max', $formatOptions) && $formatOptions['max'] !== null) {
1981-
$formatOptions['max'] = (string)$formatOptions['max'];
1982-
}
1983-
$attribute->setAttribute('formatOptions', $formatOptions);
1984-
}
1985-
}
1986-
}
1987-
1988-
$collection->setAttribute('attributes', $attributes);
1989-
1990-
return $collection;
1991-
}
1992-
19931953
/**
19941954
* Get Collection Size
19951955
*

0 commit comments

Comments
 (0)