/** * Add related buttons to projects * @param array $projects Array of project object */ public function addButtons(array $projects) { $buttonModel = new \Prolio\Model\Button(); foreach ($projects as $project) { $buttons = $buttonModel->getAllByProject($project->id); $project->buttons = $buttons; } }
public function get($project_slug = null) { $project = $this->model->getBySlug($project_slug); $tagModel = new \Prolio\Model\Tag(); $tags = $tagModel->getAllByProject($project->id); $tags = $tagModel->tagsToString($tags); $compModel = new \Prolio\Model\Compatibility(); $comps = $compModel->getAllByProject($project->id); $comps = $compModel->compatibilitiesToString($comps); $buttonModel = new \Prolio\Model\Button(); $buttons = $buttonModel->getAllByProject($project->id); $imageModel = new \Prolio\Model\Image(); $images = $imageModel->getAllByProject($project->id); if ($project) { $this->app->render('project.twig', ['project' => $project, 'tags' => $tags, 'comps' => $comps, 'buttons' => $buttons, 'images' => $images]); } else { $this->app->notFound(); } }