コード例 #1
0
ファイル: TalkApi.php プロジェクト: xsist10/joindin-web2
 /**
  * Get all talks associated with an event
  *
  * @param string $talks_uri   API talk uri
  * @param array  $queryParams
  *
  * @return array
  */
 public function getCollection($talks_uri, array $queryParams = [])
 {
     if (empty($talks_uri)) {
         $talks_uri = $this->baseApiUrl . '/v2.1/talks';
     }
     $talks = (array) json_decode($this->apiGet($talks_uri, $queryParams));
     $meta = array_pop($talks);
     $collectionData = array();
     foreach ($talks['talks'] as $item) {
         $talk = new TalkEntity($item);
         foreach ($talk->getSpeakers() as $speakerInfo) {
             if (isset($speakerInfo->speaker_uri)) {
                 $speakerInfo->username = $this->userApi->getUsername($speakerInfo->speaker_uri);
             }
         }
         $collectionData['talks'][] = $talk;
         $this->talkDb->save($talk);
     }
     $collectionData['pagination'] = $meta;
     return $collectionData;
 }