aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/Schemas/ResourcePropertySchema.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2023-12-07 14:04:18 +0100
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-10-30 12:40:05 +0000
commit288f22cd7f789e6408c4fc8dcfac19627d0ff01b (patch)
treef38fd112175dd78dd3833036e97b4f7e42ff6f85 /lib/classes/JsonApi/Schemas/ResourcePropertySchema.php
parent363c78feaae65f3dfaba40b39463e2f1156048d4 (diff)
initial commit, re #2799tic-2799
Diffstat (limited to 'lib/classes/JsonApi/Schemas/ResourcePropertySchema.php')
-rw-r--r--lib/classes/JsonApi/Schemas/ResourcePropertySchema.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/classes/JsonApi/Schemas/ResourcePropertySchema.php b/lib/classes/JsonApi/Schemas/ResourcePropertySchema.php
new file mode 100644
index 0000000..d9caf30
--- /dev/null
+++ b/lib/classes/JsonApi/Schemas/ResourcePropertySchema.php
@@ -0,0 +1,37 @@
+<?php
+namespace JsonApi\Schemas;
+
+use Neomerx\JsonApi\Contracts\Schema\ContextInterface;
+use ResourceProperty;
+
+final class ResourcePropertySchema extends SchemaProvider
+{
+ /**
+ * @param ResourceProperty $resource
+ */
+ public function getId($resource): ?string
+ {
+ return $resource->id;
+ }
+
+ /**
+ * @param ResourceProperty $resource
+ */
+ public function getAttributes($resource, ContextInterface $context): iterable
+ {
+ return [
+ 'state' => $resource->state,
+
+ 'mkdate' => date('c', $resource->mkdate),
+ 'chdate' => date('c', $resource->chdate),
+ ];
+ }
+
+ /**
+ * @param ResourceProperty $resource
+ */
+ public function getRelationships($resource, ContextInterface $context): iterable
+ {
+ return [];
+ }
+}