Skip to content

Commit

Permalink
Fix sample controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-schindler committed Oct 27, 2022
1 parent 7e44e96 commit a394986
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 42 deletions.
4 changes: 2 additions & 2 deletions Backend/Controllers/APIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class APIController extends Controller
protected array $paths = ['/api/sample'];
protected array $methods = ['POST'];

protected function execute(): void {
(new APIView())->render();
protected function execute(): View {
return new APIView();
}
}
4 changes: 2 additions & 2 deletions Backend/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ class HomeController extends Controller
{
protected array $paths = ['/'];

protected function execute(): void {
protected function execute(): View {
$layout = new LayoutView();
$layout->addChild(new HeadingView('Home'));
$layout->render();
return $layout;
}
}
4 changes: 2 additions & 2 deletions Backend/Controllers/NotCalledController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ class NotCalledController extends Controller
{
protected array $paths = ['/:type/:id'];

protected function execute(): void {
protected function execute(): View {
$layout = new LayoutView();
$layout->addChild(new HeadingView('Doesn\'t get called when only using links from the LayoutView'));
$layout->addChild(new TextView('Go and work on the Router!'));
$layout->addChild(new TextView($this->param('type')));
if (($id = $this->param('id')) !== null)
$layout->addChild(new TextView("ID: $id"));

$layout->render();
return $layout;
}
}
4 changes: 2 additions & 2 deletions Backend/Controllers/SecondHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ class SecondHome extends Controller
{
protected array $paths = ['/article/:id'];

protected function execute(): void {
protected function execute(): View {
$layout = new LayoutView();
$layout->addChild(new TextView('Welcome to another route'));
if (($id = $this->param('id')) !== null) {
$layout->addChild(new TextView("ID: $id"));
}

$layout->render();
return $layout;
}
}
34 changes: 0 additions & 34 deletions Backend/Controllers/TestController.php

This file was deleted.

0 comments on commit a394986

Please sign in to comment.