コード例 #1
0
ファイル: comment_service.php プロジェクト: vazahat/dudex
 /**
  * @param integer $entityType
  * @param array $idList
  * @return array
  */
 public function findCommentCountForEntityList($entityType, array $idList)
 {
     $commentCountArray = $this->commentDao->findCommentCountForEntityList($entityType, $idList);
     $commentCountAssocArray = array();
     $resultArray = array();
     foreach ($commentCountArray as $value) {
         $commentCountAssocArray[$value['id']] = $value['commentCount'];
     }
     foreach ($idList as $value) {
         $resultArray[$value] = array_key_exists($value, $commentCountAssocArray) ? $commentCountAssocArray[$value] : 0;
     }
     return $resultArray;
 }