コード例 #1
0
 /**
  * Fetch a list of recommendations based on a given event.
  *
  * The object should be initialized with the consumer token and user access token of the user who is doing the action.
  *
  * @param string $id
  *   CDBID of the event recommendations should be based on.
  * @param CultureFeed_RecommendationsQuery $query
  *   The query.
  * @return CultureFeed_Recommendation[]
  *   The recommendations.
  *
  * @throws CultureFeed_ParseException
  *   If the result could not be parsed.
  */
 public function getRecommendationsForEvent($id, CultureFeed_RecommendationsQuery $query = NULL)
 {
     $data = array();
     if ($query) {
         $data = $query->toPostData();
     }
     $data['eventId'] = $id;
     $result = $this->oauth_client->consumerGetAsXml('recommendation/event', $data);
     try {
         $xml = new CultureFeed_SimpleXMLElement($result);
     } catch (Exception $e) {
         throw new CultureFeed_ParseException($result);
     }
     return self::parseRecommendations($xml);
 }
コード例 #2
0
 public function getRecommendationsForEvent($id, CultureFeed_RecommendationsQuery $query = NULL)
 {
     $cid = 'recommendation:event:' . $id . ':' . md5(serialize($query->toPostData()));
     if ($cache = $this->cacheGet($cid)) {
         return $cache->data;
     }
     $data = parent::getRecommendationsForEvent($id, $query);
     $this->cacheSet($cid, $data, REQUEST_TIME + CULTUREFEED_CACHE_EXPIRES);
     return $data;
 }