From 58de4e8908729a8f55b99882a8e2a515af30ccc7 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sat, 19 Nov 2022 19:46:03 +0100 Subject: [PATCH] replace annotation with attributes --- config/packages/doctrine.yaml | 4 +- src/Controller/DashboardAdminController.php | 8 +--- src/Entity/Page/SimplePage.php | 4 +- src/Entity/User.php | 48 ++++++--------------- 4 files changed, 19 insertions(+), 45 deletions(-) diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index c54a4a2..98560ee 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -12,13 +12,13 @@ doctrine: mappings: App\Core\Entity: is_bundle: false - type: annotation + type: attribute dir: '%kernel.project_dir%/vendor/murph/murph-core/src/core/Entity' prefix: 'App\Core\Entity' alias: App\Core\Entity App\Entity: is_bundle: false - type: annotation + type: attribute dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App\Entity diff --git a/src/Controller/DashboardAdminController.php b/src/Controller/DashboardAdminController.php index 69a1856..833cf1a 100644 --- a/src/Controller/DashboardAdminController.php +++ b/src/Controller/DashboardAdminController.php @@ -6,14 +6,10 @@ use App\Core\Controller\Dashboard\DashboardAdminController as Controller; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/admin") - */ +#[Route(path: '/admin')] class DashboardAdminController extends Controller { - /** - * @Route("/", name="admin_dashboard_index") - */ + #[Route(path: '/', name: 'admin_dashboard_index')] public function index(): Response { return $this->render('admin/dashboard.html.twig'); diff --git a/src/Entity/Page/SimplePage.php b/src/Entity/Page/SimplePage.php index 97aaba0..9d438cd 100644 --- a/src/Entity/Page/SimplePage.php +++ b/src/Entity/Page/SimplePage.php @@ -11,9 +11,7 @@ use App\Core\Form\Site\Page\TextBlockType; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Form\FormBuilderInterface; -/** - * @ORM\Entity - */ +#[ORM\Entity] class SimplePage extends Page { public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Entity/User.php b/src/Entity/User.php index 1f6c86a..c0e5138 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -10,64 +10,44 @@ use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; -/** - * @ORM\Entity(repositoryClass=UserRepository::class) - * @ORM\HasLifecycleCallbacks() - */ +#[ORM\Entity(repositoryClass: UserRepository::class)] +#[ORM\HasLifecycleCallbacks] class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFactorInterface, EntityInterface { use Timestampable; - /** - * @ORM\Id - * @ORM\GeneratedValue - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: 'integer')] private $id; - /** - * @ORM\Column(type="string", length=180, unique=true) - */ + #[ORM\Column(type: 'string', length: 180, unique: true)] private $email; - /** - * @ORM\Column(type="json") - */ + #[ORM\Column(type: 'json')] private $roles = []; /** * @var string The hashed password - * @ORM\Column(type="string") */ + #[ORM\Column(type: 'string')] private $password; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: 'string', length: 255, nullable: true)] private $displayName; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: 'string', length: 255, nullable: true)] private $totpSecret; - /** - * @ORM\Column(type="datetime", nullable=true) - */ + #[ORM\Column(type: 'datetime', nullable: true)] private $passwordRequestedAt; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: 'string', length: 255, nullable: true)] private $confirmationToken; - /** - * @ORM\Column(type="boolean", options={"default"=0}) - */ + #[ORM\Column(type: 'boolean', options: ['default' => 0])] private $isAdmin; - /** - * @ORM\Column(type="boolean", options={"default"=0}) - */ + #[ORM\Column(type: 'boolean', options: ['default' => 0])] private $isWriter; public function __construct()