"test driven development" Am Montag, 4. Februar 2013 22:56:21 UTC+1 schrieb cricket: > > It's ok to design a model that expects User data but you should pass > it to the model from the controller. > > What's TDD? > > On Sun, Feb 3, 2013 at 9:38 PM, Tony Messias <[email protected]<javascript:>> > wrote: > > Well, I believe it's possible to get the authenticated user from > anywhere > > using the AuthComponent::user() static method (cake 2.x). I tried it > here, > > and it worked.. but I couldn't test it using TDD, I found it veeery > hard.. > > Could anyone help? How can I test a model that depends on a logged user? > Is > > it right (this kind of dependency)? > > > > > > -- > > > > Luiz Antonio S Messias > > Desenvolvedor Web > > > > @tonyzrp > > LinkedIn > > > > > > On 1 February 2013 19:46, Andrew Wilson > > <[email protected]<javascript:>> > wrote: > >> > >> 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 [email protected] <javascript:>. > >> To post to this group, send email to > >> [email protected]<javascript:>. > > >> Visit this group at http://groups.google.com/group/cake-php?hl=en. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > > > -- > > 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 [email protected] <javascript:>. > > To post to this group, send email to [email protected]<javascript:>. > > > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > >
-- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
