Skip to content

Commit b8ae528

Browse files
author
Matías Pizarro
authored
Update operations.md
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.
1 parent adbfcca commit b8ae528

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

core/operations.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ class Answer
304304

305305
namespace App\Entity;
306306

307-
use ApiPlatform\Core\Annotation\ApiProperty;
308307
use ApiPlatform\Core\Annotation\ApiResource;
309308
use ApiPlatform\Core\Annotation\ApiSubresource;
310309
use Doctrine\ORM\Mapping as ORM;
@@ -519,7 +518,7 @@ class Question
519518

520519
API Platform can leverage the Symfony routing system to register custom operations related to custom controllers. Such custom
521520
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)
523522
helper class.
524523

525524
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:
923922
namespace App\Controller;
924923
925924
use App\Entity\Book;
926-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
925+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
927926
928-
class BookController extends Controller
927+
class BookController extends AbstractController
929928
{
930-
public function specialAction(Book $data, MyService $service): Book
929+
public function special(Book $data, MyService $service): Book
931930
{
932931
return $service->doSomething($data);
933932
}

0 commit comments

Comments
 (0)