The obvious solution for this is, make all entity managers & database
connections "private"
services and introduce a service "cms.database.registry" or something
that knows which
database to pick.
Or overwrite the implementation of the new doctrine registry (Beta 2)
by your own
and introduce this handling.
I dont see why this is hard? You just have to think about replacing
services.
On Thu, 12 May 2011 12:31:00 -0700 (PDT), Bart Guliker wrote:
Thanks Christophe,
The environment variable thing looks good. However we're running on
Windows-servers on IIS, and as far as i know it's not possible to set
environment/server variables like that on a Windows machine.
I have however found another way to do what i want: create a front
controller per customer and rewrite a customer's domain to a certain
front controller. I can then have a configuration file per customer,
inheriting everything from config.yml but the database connection.
It's not a very beautiful approach, but as far as preliminary testing
has shown it should work like a charm.
Regards,
Bart
On May 12, 11:58 am, Christophe COEVOET <[email protected]> wrote:
Le 12/05/2011 11:31, Bart Guliker a crit :
> The company i work for has started developing a content management
> system on top of Symfony 2. The situation we'd like to create is
to
> have a separate database per customer. The application itself
however
> needs to remain centralised for obvious maintainance related
stuff.
> The problem we now face is with logging in. What we'd like to do
is
> have customerdomain.com/cms redirect to the central cms system,
and
> the domain the request originated from would then serve as an
> indicator for which database to use.
> However, it's very hard if not impossible to make symfony
understand
> that the entity manager or db-connection it should choose depends
on
> various parameters. For example, i have a custom user entity
hooked up
> to an entity manager which has a certain connection associated
with
> it.
> We need to make either the connection on that entity manager or
the
> entity manager itself dynamic. As far as i can see symfony won't
let
> me override the default behavior of the login-related code.
> With an entity you create yourself it's pretty easy, just ask the
> container for a certain entity manager. The login component
however
> won't let me do that.
> Any chance this could be made a lot easier? Thanks in advance.
check this pull request adding a cookbook entry. It is what you
need.https://github.com/symfony/symfony-docs/pull/273/files
--
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