0

I catch this error Class "App\Entities\Test" is not a valid entity or mapped super class

Path to entities is correct

Database's name is too correct. I have checked its about million times.

My entity:

namespace App\Entities;

use Doctrine\ORM\Mapping as ORM;

/**
 * Class Test
 * @package App\Entities
 * @ORM\Entity
 * @ORM\Table(name="test")
 */
class Test
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Column(type="integer", name="id")
     */
    protected int $id;
    /**
     * @ORM\Column(type="string", name="name")
     */
    protected string $name;
    /**
     * @ORM\Column(type="string", name="pass")
     */
    protected string $password;

   //Getters and setters 

}

Initialization:

$test = new Test();
        $test->setName('name');
        $test->setPassword('123');

        $entityManager = $this->container->get(EntityManager::class);

        $entityManager->persist($test);

        $entityManager->flush();

Where is my mistake? I re-readed documentations many times, googled it

  • What is the context for this error? What are you trying to do when the error occours? – Oli Apr 07 '21 at 20:47
  • 1
    I got the answer on https://stackoverflow.com/questions/17473225/doctrine2-no-metadata-classes-to-process –  Apr 08 '21 at 13:12

0 Answers0