Prezent / doctrine-translatable

Translatable behaviour extension for Doctrine2
MIT License
26 stars 17 forks source link

PHP 8 Attributes / AttributeDriver #43

Open barthy-koeln opened 2 years ago

barthy-koeln commented 2 years ago

Dear Prezent Team,

using this library in a PHP 8.1 and Symfony 5.4 project, I've had to work around this Issue:

In DoctrineAdapter.php line 110:

Cannot adapt Doctrine driver of class Doctrine\ORM\Mapping\Driver\AttributeDriver

The DriverChain in my project contains regular annotation drivers as well, and a hackaround to get rid of the error seems to result in the usual and desired behaviour:

if($omDriver instanceof AttributeDriver){
  $reader = new AnnotationReader();
  return new AnnotationDriver($reader);
}

If I understand correctly, the best way to resolve this would be by actually supporting PHP8 attributes while maintaining support for annotations. Is that correct?

I could try to provide a minimal repoduction repository.

Thanks & Greetings Barthy