Missing Namespace in Doctrine Generated Entities?

Go To StackoverFlow.com


I'm generating entities using doctrine 2 from the command line but my application requires a namespace to be set, how can I make sure that the created entities will have namespace Entities; at the top?

2012-04-03 21:39
by MikeGA


Create next file structure:


and User.php model has next namespace:

namespace Entities;

class User { ... }

$user = new \Entities\User(); 

dont forget to set

$driverImpl = $config->newDefaultAnnotationDriver('/path/to/app/application/models/Entities');
2012-04-06 08:30
by Askent
I have exactly the file structure that you suggest, I failed to mention that my entities files are created by using yalm files, If I was creating the class entities manually I guess I could add the missing line for the namespace, I guess I'm still lost with this doctrine thing.. - MikeGA 2012-04-06 20:29