Yes, I have exactly one database per customer and one more for supervision purpose (where access to customer databases are defined).

Le 21/12/09 16:08, Daniel Latter a écrit :
Hi,

I have a situation very similar to yours, although I am not sure about the answer to your question, I have a quesiton for you: when you say you have several databases, what do you mean? do you mean one per customer/application?

Thanks
Dan





2009/12/21 Guillaume ORIOL <[email protected]>
Working on an application that is the same for multiple customers, I had to face a design option.
I wanted to avoid installing the application as many times as we had customers (for maintenance reasons).
Therefore I chose to have a unique code installation but several databases.
Each customer would access its application by adding its account name to the application base URL:
webapp.domain.com/account1/
webapp.domain.com/account2/
etc.

Following this URL prefix are the regular MVC parameters, ie:
webapp.domain.com/account1/module/controller/action

I define a default route replacement in my Bootstrap including the account parameter (see below) and retrieve this special parameter from a FrontController plugin where I setup the default database adapter.

I encounter a problem with functions that build URLs (for instance $view->url(...) or $redirector->gotoRoute(...), etc.).
All of these functions should add the current account parameter at the beginning of the URL, but none of them is aware of it.
(It should also apply to other functions like $page->getHref() for Zend_Navigation.)

What design option would you suggest (overload all of these functions, change dynamically the base URL of the application)?

Thanks for any help
- - - - -
Here is the redefined default route:
       $route = new Zend_Controller_Router_Route(
           ':account/:module/:controller/:action/*',
           array(
                 'account'    => 'demo',
                 'module'     => 'default',
                 'controller' => 'index',
                 'action'     => 'index')
       );
       $router->addRoute('default', $route);

I would also like to make "webapp.domain.com/account1/module/controller/action" equivalent to "account1.webapp.domain.com/module/controller/action". I guess it is possible with the Zend_Controller_Router_Route_Hostname, but did not try already.

$route = new Zend_Controller_Router_Route_Hostname(
   ':account.webapp.domain.com',
   array(
       'module'     => 'default',
       'controller' => 'index',
       'action'     => 'index'
   )
);
--

Guillaume ORIOL




--

Guillaume ORIOL
[email protected]
Technema
TECHNEMA
TÈl : 01 60 94 70 30
Fax : 01 60 03 12 40
Mob : 06 81 43 04 06

Reply via email to