"This is true for components too." would mean this true for the use of models in components. ( $this->controller->.. )
On Feb 26, 10:43 am, "CraZyLeGs" <[EMAIL PROTECTED]> wrote: > > First of all, and IMHO when you need to access a model from a controller, > > better set it in the $uses array rather than taking advantage of model > > linking. > > If it's there, no need for $uses. > I think performance is much more important than Source code > readability, and hey $this->modelClass->AssocModel isn't that ugly > compared to $this->AssocModel > > a rule of thumb would be: > When trying to use a model, first thing to check is, is it linked to a > model I already have. if it's not available, and if I'm going to use > it in quite a few of the actions, put it in uses, if it's just a quick > use, check the Registry if it's not there, loadModel()-it and create > it. > > This is true for components too. > > Regards. > On Feb 26, 4:30 am, Langdon Stevenson <[EMAIL PROTECTED]> > wrote: > > > Hi Mariano > > > Thanks once again for the detailed reply. Much appreciated. > > > > First of all, and IMHO when you need to access a model from a controller, > > > better set it in the $uses array rather than taking advantage of model > > > linking. > > > Point taken. I will have to think about this. As mentioned, I find > > that relying on the $uses array inevitably means that I waste a lot of > > time debugging controllers with missing models. > > > <snip all the good stuff> > > > > I'm wondering what data you need to send to *all* models, perhaps there's > > > a > > > better way to do the whole thing... > > > Valid question. The data that is needed by each model is a list of the > > data related Aco groups that the logged in user has access to. > > > Every model/controller in the application has security attached to it, > > therefore every model needs to know what data groups a user is able to > > access. This array of Acos is used to append a condition onto every > > query using beforeFind etc. > > > Currently that list is generated each time the user calls a page. I > > guess that one option would be to store the array in the user's session > > and retrieve it from there in appModel. I have steered away from that > > so far as it makes development harder when ACL details are changing > > frequently. That is sorted now though, so perhaps it's not such a big > > issue. > > > I realise that I am showing my weakness in PHP here, so appreciate the > > assistance even more. > > > Regards, > > Langdon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
