/** * Returns user's photo albums list * * @param $entityId * @param $entityType * @param int $page * @param int $limit * @return array of PHOTO_BOL_PhotoAlbum */ public function findEntityAlbumList($entityId, $entityType, $page, $limit) { $albums = $this->photoAlbumDao->getEntityAlbumList($entityId, $entityType, $page, $limit); $list = array(); if ($albums) { $albumIdList = array(); foreach ($albums as $key => $album) { array_push($albumIdList, $album->id); $list[$key]['dto'] = $album; } $covers = $this->getAlbumCoverForList($albumIdList); $counters = $this->countAlbumPhotosForList($albumIdList); foreach ($albums as $key => $album) { $list[$key]['cover'] = $covers[$album->id]; $list[$key]['photo_count'] = $counters[$album->id]; } } return $list; }