-
- //Set sql request
- $sql =<<<SQL
-SELECT
- b.*,
- GROUP_CONCAT(us.user_id) AS users
-FROM (
- SELECT
- a.*,
- GROUP_CONCAT(ud.dance_id) AS dances
- FROM (
- SELECT
- t.id AS tid,
- t.mail AS gmail,
- t.user_id,
- t.access,
- t.refresh,
- t.expired,
- GROUP_CONCAT(c.id) AS cids,
- GROUP_CONCAT(c.mail) AS cmails,
- GROUP_CONCAT(c.summary) AS csummaries,
- GROUP_CONCAT(c.synchronized) AS csynchronizeds
- FROM google_tokens AS t
- JOIN google_calendars AS c ON (c.google_token_id = t.id)
- GROUP BY t.id
- ORDER BY NULL
- LIMIT 100000
- ) AS a
- LEFT JOIN users_dances AS ud ON (ud.user_id = a.user_id)
- GROUP BY a.tid
- ORDER BY NULL
- LIMIT 100000
-) AS b
-LEFT JOIN users_subscriptions AS us ON (us.subscriber_id = b.user_id)
-GROUP BY b.tid
-ORDER BY NULL
-SQL;
- #$sessions = $this->doctrine->getRepository(Session::class)->findAllByDanceUserModified($filter['dance'], $filter['user'], $calendar['synchronized']);
- //Iterate on google tokens
- foreach($tokens as $token) {
- //TODO: clear google client cache
- //TODO: set google token
- //Iterate on google calendars
- foreach($calendars as $calendar) {
- //Fetch sessions to sync
- $sessions = $this->doctrine->getRepository(Session::class)->findAllByDanceUserModified($filter['dance'], $filter['user'], $calendar['synchronized']);
- }
- }