public function __construct(array $data, ItemsService $itemsService) { $this->itemsService = $itemsService; $this->listing = $data['listing']; $this->items = $data['items']; $items = $this->itemsService->prepareDisplayableItemsCollection($this->items); $this->entireListingItemsCollection = $this->itemsService->generateEntireTable($items, \DateTime::createFromFormat('!Y-m', $this->listing['l_year'] . '-' . $this->listing['l_month'])); }
/** * @param Listing $listing * @return IDisplayableItem[] */ public function generateEntireTable(Listing $listing) { $listingItems = $this->listingItemsReader->findListingItems($listing); $displayableItems = $this->prepareDisplayableItemsCollection($listingItems); return $this->itemsService->generateEntireTable($displayableItems, $listing->getPeriod()); }