From: Raphaƫl Gertz Date: Sun, 7 Apr 2024 02:00:49 +0000 (+0200) Subject: Append dances and subscriptions to findAllIndexed results X-Git-Tag: 0.5.0~8 X-Git-Url: https://git.rapsys.eu/airbundle/commitdiff_plain/36367b3d9770a29f2e516e40524c5d4eef8a9aca?ds=inline Append dances and subscriptions to findAllIndexed results --- diff --git a/Repository/GoogleTokenRepository.php b/Repository/GoogleTokenRepository.php index fa2a854..7c96e72 100644 --- a/Repository/GoogleTokenRepository.php +++ b/Repository/GoogleTokenRepository.php @@ -29,20 +29,51 @@ class GoogleTokenRepository extends Repository { //Set the request $req = <<addScalarResult('cmails', 'cmails', 'string') ->addScalarResult('csummaries', 'csummaries', 'string') ->addScalarResult('csynchronizeds', 'csynchronizeds', 'string') + ->addScalarResult('dids', 'dids', 'string') + ->addScalarResult('sids', 'sids', 'string') ->addIndexByScalar('tid'); //Set result array @@ -98,10 +131,12 @@ SQL; 'access' => $token['access'], 'refresh' => $token['refresh'], 'expired' => $token['expired'], - 'calendars' => [] + 'calendars' => [], + 'dances' => [], + 'subscriptions' => [] ]; - //Iterate on + //Iterate on calendars foreach($cids as $k => $cid) { $result[$tid]['calendars'][$cid] = [ 'id' => $cid, @@ -110,6 +145,26 @@ SQL; 'synchronized' => $csynchronizeds[$k] ]; } + + //Set dids + $dids = explode("\n", $token['dids']); + + //Iterate on dances + foreach($dids as $k => $did) { + $result[$tid]['dances'][$did] = [ + 'id' => $did + ]; + } + + //Set sids + $sids = explode("\n", $token['sids']); + + //Iterate on subscriptions + foreach($sids as $k => $sid) { + $result[$tid]['subscriptions'][$sid] = [ + 'id' => $sid + ]; + } } //Return result