Example #1
0
 public function getPointWithGroup()
 {
     $group = $this->getPointGenre();
     App::import('Model', 'Item');
     //別モデルを呼び出し, HogeRelationを使う
     $item = new Item();
     foreach ($group as $g => $v) {
         $conditions['conditions'] = array('group_id' => $g, 'genre_id' => GENREPOINT);
         $all = $this->find('all', $conditions);
         foreach ($all as $k => $v) {
             $count = $item->getItemsCount(array('genres like' => '%,' . $v['Genre']['id'] . ',%', 'valid' => 1));
             $all[$k]['Genre']['count'] = $count;
         }
         $ret[$g] = $all;
     }
     return $ret;
 }