You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace the base Controller class with AbstractController (Controller class is deprecated), remove an unused use statement and delete the 'Action' suffix in the method names.
Copy file name to clipboardExpand all lines: core/operations.md
+4-5Lines changed: 4 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -304,7 +304,6 @@ class Answer
304
304
305
305
namespace App\Entity;
306
306
307
-
use ApiPlatform\Core\Annotation\ApiProperty;
308
307
use ApiPlatform\Core\Annotation\ApiResource;
309
308
use ApiPlatform\Core\Annotation\ApiSubresource;
310
309
use Doctrine\ORM\Mapping as ORM;
@@ -519,7 +518,7 @@ class Question
519
518
520
519
API Platform can leverage the Symfony routing system to register custom operations related to custom controllers. Such custom
521
520
controllers can be any valid [Symfony controller](http://symfony.com/doc/current/book/controller.html), including standard
522
-
Symfony controllers extending the [`Symfony\Bundle\FrameworkBundle\Controller\Controller`](http://api.symfony.com/3.1/Symfony/Bundle/FrameworkBundle/Controller/Controller.html)
521
+
Symfony controllers extending the [`Symfony\Bundle\FrameworkBundle\Controller\AbstractController`](http://api.symfony.com/4.1/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.html)
523
522
helper class.
524
523
525
524
However, API Platform recommends to use **action classes** instead of typical Symfony controllers. Internally, API Platform
@@ -923,11 +922,11 @@ exactly the same thing than the previous example in a more Symfony-like fashion:
923
922
namespace App\Controller;
924
923
925
924
use App\Entity\Book;
926
-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
925
+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
927
926
928
-
class BookController extends Controller
927
+
class BookController extends AbstractController
929
928
{
930
-
public function specialAction(Book $data, MyService $service): Book
929
+
public function special(Book $data, MyService $service): Book
0 commit comments