Skip to content

Commit

Permalink
[Google] Add raw response for other Google objects
Browse files Browse the repository at this point in the history
  • Loading branch information
rgazelot committed Feb 9, 2015
1 parent 88572e1 commit a8ecef8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Adapter/Google/AbstractEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ abstract class AbstractEvent extends BaseAbstractEvent
/** @var User[] All the fetched and hydrated users, with an id as a key **/
protected static $users = [];

/** @var array $raw The raw response stored for this object */
protected $raw;

public function __construct(Calendar $calendar, $status = self::STATUS_TENTATIVE)
{
$this->status = $status;
Expand Down
5 changes: 5 additions & 0 deletions src/Adapter/Google/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class Calendar extends AbstractCalendar
/** @var When fetching a list, fetch only starting a certain token */
protected $nextSyncToken = null;

/** @var array $raw The raw response stored for this object */
protected $raw;

public function __construct($id, $name, DateTimeZone $timeZone)
{
$this->id = $id;
Expand Down Expand Up @@ -90,6 +93,8 @@ public static function hydrate(array $data, User $user = null)
$calendar->addPermission(UserPermission::hydrate($calendar, $user, $data['accessRole']));
}

$calendar->raw = $data;

return $calendar;
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/Adapter/Google/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class User extends BaseUser
/** @var string user's identifier */
private $id;

/** @var array $raw The raw response stored for this object */
protected $raw;

public function __construct($name, $email, $id = null)
{
parent::__construct($name, (array) $email);
Expand Down Expand Up @@ -71,6 +74,8 @@ public static function hydrate(array $data)
$user->id = $data['id'];
}

$this->raw = $data;

return $user;
}
}
Expand Down

0 comments on commit a8ecef8

Please sign in to comment.