Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORM\Embedded attribute not working (formerly: attributes instead of annotations) #83

Open
jerome2710 opened this issue Dec 29, 2023 · 1 comment

Comments

@jerome2710
Copy link

Annotations are being removed in favor of PHP 8 attributes.

Could we get an #[Encrypted] attribute, just like the current @Encrypted annotation?

This will likely result in the need of adjusting the subscriber as well, as it currently uses the Doctrine\Common\Annotations\Reader.

It is currently possible combine Doctrine attributes and the Encrypted annotation. However, when using the #[ORM\Embeddable] attribute, the subscriber does not decrypt embeddables as it only scans for annotations: https://github.com/absolute-quantum/DoctrineEncryptBundle/blob/master/src/Subscribers/DoctrineEncryptSubscriber.php#L246.

@jerome2710
Copy link
Author

jerome2710 commented Jan 3, 2024

I have been debugging this to create a merge request. The Reader-class called at https://github.com/absolute-quantum/DoctrineEncryptBundle/blob/master/src/Subscribers/DoctrineEncryptSubscriber.php#L246 is actually autowired to a custom Reader: https://github.com/absolute-quantum/DoctrineEncryptBundle/blob/master/src/Mapping/AttributeAnnotationReader.php. This reader checks both annotations as attributes.

But unfortunately, for some reason only Gedmo annotations are allowed: https://github.com/absolute-quantum/DoctrineEncryptBundle/blob/master/src/Mapping/AttributeReader.php#L70. The #[ORM\Embedded(...)] is not a Gedmo annotation and therefore it is not working. Commenting out L70 & L75 makes it work for me.

@jerome2710 jerome2710 changed the title attributes instead of annotations ORM\Embedded attribute not working (formerly: attributes instead of annotations) Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant