Skip to content

Commit 02aeae2

Browse files
committed
feature #20 Extending from AbstractController in controller skeletons (yceruto)
This PR was merged into the 1.0-dev branch. Discussion ---------- Extending from AbstractController in controller skeletons > https://symfony.com/doc/master/best_practices/controllers.html#controllers > [Best Practice] Make your controller extend the `AbstractController` base controller provided by Symfony and use annotations to configure routing, caching and security whenever possible. > https://symfony.com/doc/master/best_practices/controllers.html#fetching-services > [Best Practice] Don't use `$this->get()` or `$this->container->get()` to fetch services from the container. Instead, use dependency injection. Commits ------- b1701e2 Extending from AbstractController in controller skeletons
2 parents dec1e7a + b1701e2 commit 02aeae2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Resources/skeleton/controller/Controller.php.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace App\Controller;
44

55
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
77
use Symfony\Component\HttpFoundation\Response;
88

9-
class {{ controller_class_name }} extends Controller
9+
class {{ controller_class_name }} extends AbstractController
1010
{
1111
/**
1212
* @Route("{{ route_path }}", name="{{ route_name }}")

src/Resources/skeleton/controller/ControllerWithTwig.php.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace App\Controller;
44

55
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
77
use Symfony\Component\HttpFoundation\Response;
88

9-
class {{ controller_class_name }} extends Controller
9+
class {{ controller_class_name }} extends AbstractController
1010
{
1111
/**
1212
* @Route("{{ route_path }}", name="{{ route_name }}")

0 commit comments

Comments
 (0)