public function generate($year, User $user, array $settings = [])
 {
     $listings = $this->listingsReader->getAnnualListingsForPDFGeneration($year, $user);
     $listings = Arrays::associate($listings, 'l_id');
     $items = $this->listingItemsReader->findListingsItems(array_keys($listings));
     $pdfFiles = [];
     $listingItemsCollection = [];
     /**
      * @var int $listingId
      * @var IListingPdfSource $pdfSource
      */
     foreach ($listings as $listingId => $listing) {
         foreach ($items as $key => $item) {
             if ($item->getListing()->getId() == $listingId) {
                 $listingItemsCollection[] = $item;
                 unset($items[$key]);
             }
         }
         $pdfFiles[] = $this->listingPdfGenerator->generate($listing, $listingItemsCollection, $settings);
         $listingItemsCollection = [];
     }
     $zipStorageFilePath = $this->storagePath . '/' . $user->getId() . '/' . $year . "/vycetky-{$year}.zip";
     return $this->zipFiles($pdfFiles, $zipStorageFilePath);
 }
 /**
  * @param User|null $user
  * @return array
  */
 public function getListingsYears(User $user = null)
 {
     return Arrays::associate($this->listingsReader->getListingsYears($user), 'year');
 }