Skip to content

Commit

Permalink
minor #6471 Use attributes instead of annotations in the docs (javier…
Browse files Browse the repository at this point in the history
…eguiluz)

This PR was squashed before being merged into the 4.x branch.

Discussion
----------

Use attributes instead of annotations in the docs

Commits
-------

b3d9ac3 Use attributes instead of annotations in the docs
  • Loading branch information
javiereguiluz committed Oct 13, 2024
2 parents c50e2bf + b3d9ac3 commit 1faae84
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
17 changes: 5 additions & 12 deletions doc/actions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -487,33 +487,27 @@ Symfony controller called ``BusinessStatsController``::
namespace App\Controller\Admin;

use App\Stats\BusinessStatsCalculator;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;

/**
* @Security("is_granted('ROLE_ADMIN')")
*/
#[IsGranted('ROLE_ADMIN')]
class BusinessStatsController extends AbstractController
{
public function __construct(BusinessStatsCalculator $businessStatsCalculator)
{
$this->businessStatsCalculator = $businessStatsCalculator;
}

/**
* @Route("/admin/business-stats", name="admin_business_stats")
*/
#[Route("/admin/business-stats", name="admin_business_stats")]
public function index()
{
return $this->render('admin/business_stats/index.html.twig', [
'data' => $this->businessStatsCalculator->getStatsSummary(),
]);
}

/**
* @Route("/admin/business-stats/{id}", name="admin_business_stats_customer")
*/
#[Route("/admin/business-stats/{id}", name="admin_business_stats_customer")]
public function customer(Customer $customer)
{
return $this->render('admin/business_stats/customer.html.twig', [
Expand Down Expand Up @@ -630,7 +624,6 @@ by EasyAdmin::

use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class SomeController extends AbstractController
{
Expand Down
10 changes: 4 additions & 6 deletions doc/dashboards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dashboard with the ``make:admin:dashboard`` command, the route is defined using
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;
class DashboardController extends AbstractDashboardController
{
Expand Down Expand Up @@ -155,7 +155,7 @@ application, you can define an explicit route name to simplify your code:
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;
class DashboardController extends AbstractDashboardController
{
Expand Down Expand Up @@ -893,14 +893,12 @@ applications can rely on its default values:
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class SecurityController extends AbstractController
{
/**
* @Route("/login", name="login")
*/
#[Route("/login", name="login")]
public function login(AuthenticationUtils $authenticationUtils): Response
{
$error = $authenticationUtils->getLastAuthenticationError();
Expand Down
2 changes: 1 addition & 1 deletion doc/fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ To do so, add the following method to the entity::

use Doctrine\ORM\Mapping as ORM;

/** @ORM\Entity */
#[ORM\Entity]
class Customer
{
// ...
Expand Down

0 comments on commit 1faae84

Please sign in to comment.