Monday, April 26, 2010

Re: doing complex sql using query or find? outpit with tablecell()?

For reports it does make sense to create a modelless controller. All
calls to retrieve model data should be done within a controller and
passed to the view using $this->set(), so so far you are doing
everything correct.

I personally use ClassRegistry::init('ModelName')->find(); when
calling functions from models which are not associated with my
controller and if I am not mistaken calling this twice still only
calls one instance of the model. This way your not calling ALL models
when you may only be using one or two of the models for the report you
are showing.

But remember once you have called ClassRegistry::init('ModelName')-
>find(); you can also use ClassRegistry::init('ModelName')-
>AssociatedModel->find(); or use containable etc to pull the data in
from other models.

I'm still on Cake 1.2.6 as 75% of the way through a big project, but
itching to move to 1.3 especially now we have a stable release.

HTH

Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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

No comments: