urlBuilder = $urlBuilder; } /** * Format samples from collection as array * * @param SampleInterface[] $samples * @return array */ public function execute(array $samples): array { $data = []; foreach ($samples as $key => $sample) { $data[$key] = [ 'id' => $sample->getId(), 'sort_order' => $sample->getSortOrder(), 'title' => $sample->getTitle(), 'sample_url' => $this->urlBuilder->getUrl( 'downloadable/download/sample', ['sample_id' => $sample->getId()] ), ]; } return $data; } }