Hi everyone, I've been searching for an answer and experimenting for a whole day now. Enough is enough! =)
Simply put, I have two modules; The main Application module which holds a User entity and a second one, Auth, for authentication and registration that tries to make use of this entity. Since I obviously don't want the two modules to be dependent on each other I'd like the Auth module to try to use its own (non-existing) entity "Auth\Entity\User" but this should be overridden by the application to "Application\Entity\User". The first case where I try to use the Application modules User entity from within the Auth module is when registering and a new User should be created. Here I have to create a new instance of User and to be able to override it I use the ServiceLocator, so that I can register an invokable on application level, pointing "Auth\Entity\User" to "Application\Entity\User". This works, but is this really the way to do it? The second case is when I try to login a user. For simplicity sake there's no AuthenticationService involved now, I simply fetch the User from it's repository using the email. This is where I'm totally stuck. I'm tring to use $entityManager->getRepository('Auth\Entity\User'), But it seems impossible to override this on application level to "Application\Entity\User". I've tried all sorts of configurations in global.config.php and even directly in the Auth modules config-file to tell it to use the Appllication Entities but nothing works. Does anyone know how to do this stuff? Or maybe what search terms I should use? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-Doctrine2-Sharing-entities-between-modules-impossible-tp4661541.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com