I've got the same issue on a project I'm working on.  Any solutions you 
came up with Dylan?


On Monday, August 6, 2012 4:02:15 PM UTC-6, Dylan Jennings wrote:
>
> Hello
>
> I'm currently building a SaaS application using cakePHP. I've worked with 
> cakePHP before a few times and I'm comfortable with how it all works.
>
> So, I have an `accounts` table which holds information about each tenant, 
> and then a `users` table aswell, which will contain the users for each 
> account/tenant. New users will initially be added through a basic plain PHP 
> or WordPress front-end, so there won't be the need to create new `accounts` 
> through the cakePHP side of the app.
>
> Just to be clear, each tenant will be on a subdomain of the main domain. 
> For example, http://dylan.mycakeapp.dev/ could be a tenant. The front-end 
> site will be held in the root of the site, http://mycakeapp.dev/. When 
> new users sign up on the front-end site, their `accounts` record and a 
> single `users` record will be created, they will get redirected to their 
> subdomain, and the cakePHP app will take it from there.
>
> So here's the problem. I want all tenants to share the same database, 
> separated by an 'account_id' which will be in all tables. I'm not 100% on 
> this, but I think the correct approach is to use the 'beforeSave', 
> 'beforeDelete' and 'beforeFind' callbacks in the model, and simply add the 
> `account_id` as a query condition. The problem comes when I'm trying to 
> detect which tenant to use, because I can't use the database within the 
> model.
>
> Does anyone have any experience with SaaS/multi-tenancy apps in cakePHP, 
> and can help? Thanks in advance.
>
> Cheers
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to