From d3913c422b49060dbfa759b281f69467e41dddc8 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 19 Feb 2024 23:57:54 +1300 Subject: [PATCH] Add compound UID valdiator --- .../Utopia/Database/Validator/CompoundUID.php | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/Appwrite/Utopia/Database/Validator/CompoundUID.php diff --git a/src/Appwrite/Utopia/Database/Validator/CompoundUID.php b/src/Appwrite/Utopia/Database/Validator/CompoundUID.php new file mode 100644 index 0000000000..3f23500952 --- /dev/null +++ b/src/Appwrite/Utopia/Database/Validator/CompoundUID.php @@ -0,0 +1,58 @@ +isValid($id)) { + return false; + } + } + + return true; + } + + public function getType(): string + { + return self::TYPE_STRING; + } + + public static function parse(string $key): array + { + $parts = \explode(':', $key); + $result = []; + + foreach ($parts as $part) { + $result[] = $part; + } + + return $result; + } +}