ぐるなびAPIをつかってお店情報まで順に表示させるところまでできた。あとはお店情報とそのお店に関するブログのレビューを関連づけてマージして表示するところだ。ここが肝になりそうなかんじ。あとレスポンスが悪いのでキャッシングを考えた方がいいかも。作ってみると意外といまいちだ。。。もうひとひねりいる感じ。
API経由でデータ取得するDAOはメソッドの切り分けを間違えていたことに気づいたので少し改善した。

<?php
Class StoreDao
{
  private $keyID;
  private $url;

  function __construct()
  {
    $this->keyID = "key";
    $this->url = "http://api.gnavi.co.jp/ver1/RestSearchAPI/?keyid=".$this->keyID;
    
  }

  public function getStoresByLocation($latitude, $longitude, $range)
  {
    $stores = array();
    $access = $this->url."&latitude=".$latitude."&longitude=".$longitude."&range=".$range;

    return $this->mergeNode2Data($access);
  }

  public function getStoreByID($id)
  {
    $access = $this->url."&id=".$id;
    $datas = $this->mergeNode2Data($access);
    return $datas[0];
    
  }

  protected function mergeNode2Data($access)
  {
    
    $xml = DomDocument::load($access);
    $xpath = new DOMXPath($xml);
    $ids = $xpath->query("/response/rest/id/text()");
    $names = $xpath->query("/response/rest/name/text()");
    $urls = $xpath->query("/response/rest/url/text()");
    $addresses = $xpath->query("/response/rest/address/text()");

    $datas = array();
    for($i = 0; $i<$ids->length; $i++)
      {
	$data = new Store();
	$data->setID($ids->item($i)->wholeText);
	$data->setStoreNm($names->item($i)->wholeText);
	$data->setUrl($urls->item($i)->wholeText);
	$data->setAddress($addresses->item($i)->wholeText);
	array_push($datas, $data);     

      
      }
    return $datas;
  }
}
?>