Exemple #1
0
 /**
  * Returns rate info for provided entity id and entity type.
  * Example: array( 'entity_id' => array( 'avg_score' => 5, 'rates_count' => 35 ) ).
  *
  * @param array<integer> $entityIdList
  * @param integer $entityType
  * @return array
  */
 public function findRateInfoForEntityList($entityType, $entityIdList)
 {
     $result = $this->rateDao->findRateInfoForEntityList($entityType, $entityIdList);
     $resultArray = array();
     foreach ($result as $item) {
         $resultArray[$item['entityId']] = $item;
     }
     foreach ($entityIdList as $id) {
         if (!isset($resultArray[$id])) {
             $resultArray[$id] = array('rates_count' => 0, 'avg_score' => 0);
         }
     }
     return $resultArray;
 }