Last active
February 1, 2019 19:01
-
-
Save 0GiS0/0eab0dce11d5da554941f56655d775c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controller; | |
use App\Service\TableService; | |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\Routing\Annotation\Route; | |
class TablesController extends AbstractController | |
{ | |
/** | |
* @Route("/", name="tables") | |
*/ | |
public function index(TableService $table) | |
{ | |
return $this->render('tables/index.html.twig', [ | |
'controller_name' => 'TablesController', | |
'entities' => $table->getEntities(), | |
]); | |
} | |
/** | |
* @Route("/add/entity") | |
*/ | |
public function create(Request $request, TableService $table) | |
{ | |
$table->createEntity($request->get('firstName'), $request->get('lastName')); | |
return $this->redirectToRoute('tables'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment