diff options
author | Paul Tirk <paultirk@paultirk.com> | 2020-12-27 19:35:58 +0000 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-04-08 10:23:11 +0200 |
commit | 566a21b4a88cc1d149aef39eff7b95b42613cec5 (patch) | |
tree | afcfa2372d84aac600578aebb6ec21235360e9ac /lib/Controller | |
parent | 06a45387ef36ec29fb0b80e6481db09911ad1935 (diff) |
add possibility to serialize a reduced version of an entity
Signed-off-by: Paul Tirk <paultirk@paultirk.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r-- | lib/Controller/ApiV2ResponseTrait.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Controller/ApiV2ResponseTrait.php b/lib/Controller/ApiV2ResponseTrait.php index 2a8ed18ab..3538f1948 100644 --- a/lib/Controller/ApiV2ResponseTrait.php +++ b/lib/Controller/ApiV2ResponseTrait.php @@ -27,10 +27,10 @@ trait ApiV2ResponseTrait * * @return array */ - public function serialize($data): array + public function serialize($data, bool $reduced = false): array { if ($data instanceof IAPI) { - return $data->toAPI2(); + return $data->toAPI2($reduced); } $return = []; @@ -40,7 +40,7 @@ trait ApiV2ResponseTrait foreach ($data as $entity) { if ($entity instanceof IAPI) { - $return[] = $entity->toAPI2(); + $return[] = $entity->toAPI2($reduced); } } return $return; |