nayzo / NzoUrlEncryptorBundle

Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application
MIT License
89 stars 19 forks source link

Using attributes instead of annotation does not work #51

Closed sevenGroupFrance closed 2 years ago

sevenGroupFrance commented 2 years ago

Hi,

Using symfony6 with new php attributes instead of annontations. It seem's that ParamDecryptor does not work :

<?php

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Nzo\UrlEncryptorBundle\Annotations\ParamDecryptor;

class DefaultController extends AbstractController
{
    #[Route('/xxx/{email}/{validUntil}', name: 'routeName')]
    #[ParamDecryptor(["email", "validUntil"])]
    public function gestionCompte(string $email, string $validUntil): Response
    {
        dump($email,$validUntil);
        return $this->render('default/mypage.html.twig', []);
    }
}

the dump return not decrypted informations.

nayzo commented 2 years ago

Hello,

The PHP8 annotation it is not yet taken into account by the bundle, you can use the default format:

    #[Route('/xxx/{email}/{validUntil}', name: 'routeName')]
    /** @ParamDecryptor({"email", "validUntil"}) */
    public function gestionCompte(string $email, string $validUntil): Response

In the meantime, I'll work on adding a handler for php8 annotation.

sevenGroupFrance commented 2 years ago

Thank you for your answer. Will wait after your update.

Best regards

nayzo commented 2 years ago

Added in tag v6.2.0.

sevenGroupFrance commented 2 years ago

It works, thank you :)

Best regards