The case of doing this is : write to master read from slave. In this case I need to map all my entities to two entity managers.
Yes, I understand that this will cause different objects, but the app is working when I list all my entities in two entity managers. And seems the code which process "auto_mapping: true" is just doing same thing. Artem. On May 31, 8:06 pm, Christophe COEVOET <[email protected]> wrote: > Le 28/04/2011 14:28, Dennis Jacobfeuerborn a �crit : > > > > > > > > > With the recent auto-mapping change I'm wondering why the use of the > > auto-mapping and multiple entity managers is mutual exclusive? > > > I have an app that needs to access to multiple databases some of them > > with identical schemas. Right now I need to create an entitiy manager > > for each connection and then for each manager repeat the explicit > > bundles I want to map. What I'd rather like to do is to tell Symfony > > to do auto mapping just like I can do if I was using a single entity > > manager. > > What I'm looking for is something like this: > > > orm: > > auto_generate_proxy_classes: %kernel.debug% > > default_entity_manager: default > > entity_managers: > > default: > > connection: default > > mappings: > > AcmeDemoBundle: ~ > > db1: > > connection: db1 > > auto_mapping: true > > db2: > > connection: db2 > > auto_mapping: true > > > Is there a specific reason why auto_mapping has been added but > > specifically not been made available on a per entitiy-manager basis? > > > Regards, > > Dennis > > The reason is simple: an entity *cannot* be managed by several entity > managers. So as soon as you have several entity managers, you need to > choose which entity manager handles the entities. auto_mapping would > register all entities in each entity manager which is precisely the > broken case. > > Using the same entity to represent data coming from several databases > does not make sense. You will have 2 different objects from the same > class which would represent totally different data and nothing in your > app would let you know which data is represented by an instance. > > -- > Christophe | Stof -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
