![]() We also need the conference repository to get all conferences from the database. ![]() Symfony is smart enough to know how to inject the right object. Notice that we ask for the Twig instance by type-hinting it in the controller method. To be able to render a template, we need the Twig Environment object (the main Twig entry point). return new Response( -EOF - ) return new Response($twig->render('conference/', )) public function index(): Response public function index(Environment $twig, ConferenceRepository $conferenceRepository): Response ![]() Use Symfony\Component\Routing\Annotation\Route Ĭlass ConferenceController extends AbstractController Use Symfony\Component\HttpFoundation\Response Use Symfony\Bundle\FrameworkBundle\Controller\AbstractController use App\Repository\ConferenceRepository 31 - a/src/Controller/ConferenceController.php b/src/Controller/ConferenceController.php -2,22 2,19 App\Controller
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |