public function getSubscriptionsForUser($principalUri)
    {
        $fields = array_values($this->subscriptionPropertyMap);
        $fields[] = 'id';
        $fields[] = 'uri';
        $fields[] = 'source';
        $fields[] = 'principaluri';
        $fields[] = 'lastmodified';

        // Making fields a comma-delimited list
        $fields = implode(', ', $fields);
        $stmt = $this->pdo->prepare('SELECT '.$fields.' FROM '.$this->calendarSubscriptionsTableName.' WHERE principaluri = ? ORDER BY calendarorder ASC');
        $stmt->execute([$principalUri]);

        $subscriptions = [];
        while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
            $subscription = [
                'id' => $row['id'],
                'uri' => $row['uri'],
                'principaluri' => $row['principaluri'],
                'source' => $row['source'],
                'lastmodified' => $row['lastmodified'],

                '{'.CalDAV\Plugin::NS_CALDAV.'}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
            ];

            foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
                if (!is_null($row[$dbName])) {
                    $subscription[$xmlName] = $row[$dbName];
                }
            }

            $subscriptions[] = $subscription;
        }

        return $subscriptions;
    }
public function getSubscriptionsForUser($principalUri)
    {
        $fields = array_values($this->subscriptionPropertyMap);
        $fields[] = 'id';
        $fields[] = 'uri';
        $fields[] = 'source';
        $fields[] = 'principaluri';
        $fields[] = 'lastmodified';

        // Making fields a comma-delimited list
        $fields = implode(', ', $fields);
        $stmt = $this->pdo->prepare('SELECT '.$fields.' FROM '.$this->calendarSubscriptionsTableName.' WHERE principaluri = ? ORDER BY calendarorder ASC');
        $stmt->execute([$principalUri]);

        $subscriptions = [];
        while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
            $subscription = [
                'id' => $row['id'],
                'uri' => $row['uri'],
                'principaluri' => $row['principaluri'],
                'source' => $row['source'],
                'lastmodified' => $row['lastmodified'],

                '{'.CalDAV\Plugin::NS_CALDAV.'}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
            ];

            foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
                if (!is_null($row[$dbName])) {
                    $subscription[$xmlName] = $row[$dbName];
                }
            }

            $subscriptions[] = $subscription;
        }

        return $subscriptions;
    }
public function getSubscriptionsForUser ( $ principalUri ) { $ fields = array_values ( $ this -> subscriptionPropertyMap ) ; $ fields [ ] = 'id' ; $ fields [ ] = 'uri' ; $ fields [ ] = 'source' ; $ fields [ ] = 'principaluri' ; $ fields [ ] = 'lastmodified' ; // Making fields a comma-delimited list $ fields = implode ( ', ' , $ fields ) ; $ stmt = $ this -> pdo -> prepare ( 'SELECT ' . $ fields . ' FROM ' . $ this -> calendarSubscriptionsTableName . ' WHERE principaluri = ? ORDER BY calendarorder ASC' ) ; $ stmt -> execute ( [ $ principalUri ] ) ; $ subscriptions = [ ] ; while ( $ row = $ stmt -> fetch ( \ PDO :: FETCH_ASSOC ) ) { $ subscription = [ 'id' => $ row [ 'id' ] , 'uri' => $ row [ 'uri' ] , 'principaluri' => $ row [ 'principaluri' ] , 'source' => $ row [ 'source' ] , 'lastmodified' => $ row [ 'lastmodified' ] , '{' . CalDAV \ Plugin :: NS_CALDAV . '}supported-calendar-component-set' => new CalDAV \ Xml \ Property \ SupportedCalendarComponentSet ( [ 'VTODO' , 'VEVENT' ] ) , ] ; foreach ( $ this -> subscriptionPropertyMap as $ xmlName => $ dbName ) { if ( ! is_null ( $ row [ $ dbName ] ) ) { $ subscription [ $ xmlName ] = $ row [ $ dbName ] ; } } $ subscriptions [ ] = $ subscription ; } return $ subscriptions ; }
Returns a list of subscriptions for a principal.

Every subscription is an array with the following keys:
* id, a unique id that will be used by other functions to modify the
subscription. This can be the same as the uri or a database key.
* uri. This is just the 'base uri' or 'filename' of the subscription.
* principaluri. The owner of the subscription. Almost always the same as
principalUri passed to this method.
* source. Url to the actual feed

Furthermore, all the subscription info must be returned too:

1. {DAV:}displayname
2. {http://apple.com/ns/ical/}refreshrate
3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos
should not be stripped).
4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms
should not be stripped).
5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if
attachments should not be stripped).
7. {http://apple.com/ns/ical/}calendar-color
8. {http://apple.com/ns/ical/}calendar-order
9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
(should just be an instance of
Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of
default components).

@param string $principalUri

@return array
Returns a list of subscriptions for a principal .