Eagle1
Eagle1

Reputation: 810

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.

Upvotes: 10

Views: 12190

Answers (2)

ronald
ronald

Reputation: 1

change

"psr-0": { "": "Entity/" } // my generated entity-files

to

"psr-0": { "": "src/" } // my generated entity-files

Upvotes: 0

b166er
b166er

Reputation: 329

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!

Upvotes: 9

Related Questions