I wonder how this works with service injected by @doctrine. Can I inject the right entity manager into these services?
This is another though: Maybe I could set up 2 machine with different connection. One for master and the other for slave. Best regards, Sliver Joel Wurtz <[email protected]> 於 2011/11/11 上午12:42 寫道: > I also use a master/slave connection in my project and IMO there is no > generic approach for this problem. Each action must be considered critical > (master) or not (slave) by admitting for none critical action we can > sometimes have wrong data due to replication lag or others problems. > > In symfony2 i have implemented the following thing to easily choose the > specific connection for my controllers action > > I have > - 2 DBAL and 2 EntityManager : master and slave with master by default (So > you can inject the correct dbal or entitymanager to use for your services) > - An abstract class : ConnectionController > - An annotation : Connection > - A controller listener fired on kernel.controller event : > ConnectionControllerListener > > When my controller is an instance of ConnectionController i look at the > Connection annotation in the action method to choose which EntityManager to > inject to my controller and if there is no annotation i inject default > EntityManager. > > regardes, > Joël > > > > > > -- > 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 -- 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
