summaryrefslogtreecommitdiffstats
path: root/lib/Controller
diff options
context:
space:
mode:
authorPaul Tirk <paultirk@paultirk.com>2020-12-27 19:35:58 +0000
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 10:23:11 +0200
commit566a21b4a88cc1d149aef39eff7b95b42613cec5 (patch)
treeafcfa2372d84aac600578aebb6ec21235360e9ac /lib/Controller
parent06a45387ef36ec29fb0b80e6481db09911ad1935 (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.php6
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;