Annotation is not working in php 8.1

Fatal error : Uncaught Doctrine\Common\Annotations\AnnotationException: [Semantical Error] The annotation “@ORM\Table” in class Application\Entity\Editable was never imported. Did you maybe forget to add a “use” statement for this annotation? in php 8.1 error

Hello and welcome to our forums! :smiley:

I‘m sorry but to what are you referring? No tutorial and no documentation of Laminas and Mezzio uses a class with name Application\Entity\Editable.
Can you provide a link or give us more information so we can help you?

I’m changing php version 7.0 to 8.1.
In this time showing this error.

We are not in a forum for Doctrine here, so please check the documentation for it, there you will find an appropriate code example, which should fix your problem:

<?php
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;

#[Entity]
#[Table(name: 'message')]
class Message
{
    // ...
}

Hi @Soft_Solution,

The problem of yours is self-explanatory in the error. I’ve tested a sample application with PHP 8.1 version using annotation and it works.

You need to add a use statement like below.

use Application\Entity\Editable;

If the error still persists use the below command in the console.

composer dump-autoload