Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doctrine mapping a class that doesn't exist

I just re-installed Symfony2 and Doctrine. It's brand new.

Now I generate an entity (called account), put some simple annotation and then want to update my schema. And then:

 [Doctrine\Common\Persistence\Mapping\MappingException]               
 Class 'NRtworks\ChartOfAccountsBundle\Entity\Nathan' does not exist

But I don't have no class called Nathan (ok it's my firstname).Not anywhere in any bundle I currently have. I've had one like that but in another Symfony2 install.

Now when I create one entity named "Nathan" it works, but then it creates a schema that is not related.

Now my question is where doctrine can store "ghosts" entities ? I have tried to clear all the caches of doctrine & Symfony2 but it does not change anything.

like image 348
Eagle1 Avatar asked Dec 19 '13 17:12

Eagle1


1 Answers

i had the same problem, i solved this issue after adding autoloading-line to my composer.json:

{ "require": { "doctrine/orm": "", "symfony/yaml": "" }, "autoload": { "psr-0": {"": "config/yml/"}, // here stay my yml-schema files "psr-0": {"": "Entity/"} // my generated entity-files } }

after editing file, just execute "composer update" in youre project path, the autoloader-classes will be regenerated with the new autoloader-path. then you can generate entity-model files or do anything else.. hope this help!

like image 136
b166er Avatar answered Oct 18 '22 10:10

b166er