Look into Containable and determine if you could work with a lower level of recursion. Perhaps you could make use of unbindModel to remove associations you don't need. Off topic a bit, but worth noting, your nested in-line ternary conditionals are just absurd. Some developer down the road is going to despise you if you leave those in.
Also. !empty($var) will do the work of isset($var) and $var != '', in one swoop. On Oct 6, 3:36 pm, wmshay06 <[EMAIL PROTECTED]> wrote: > We have a customer using what was supposed to be a production system > based upon cakephp 1.1.18 - which really isn't. That aside there are > very signficiant issues that need urgent resolution, whcih we just > can't find a way to solve readily. > > 1. the number of db queries is absolutley astounding - example > constructing a left hand submenu and overview display of roughly 20-25 > table rows of data leads (with about 10 elements in each row) to > roughly 49000+ queries. This appears to be 'contructed' using a few > findAll queries. There has got to be a better way - and faster. > > 2. In some portion of the system there is a need to display a large > list of items - some approachign 1500+ long. This obviously begs for > pagination - but for the life of me the various examples I've found > don't really seem to work for what needs to be done. > > For reference the main view code at issue looks like this: > > $this->set('curtickets', > $this->Ticket->findAll((isset($this->params['url']['num']) && > $this->params['url']['num'] != '' ? ($this- > >params['url']['num2'] != '' ? "ticket_number >= '{$this->params['url'] > > ['num']}' AND ticket_number <= '{$this->params['url']['num2']}' AND > " : "ticket_number = '{$this->params['url']['num']}' AND ") : ''). > ($type ? "type = '{$type}' AND " : '').($sub ? "subcontractor_id = > '{$sub}' AND " : '') . "Ticket.job_id = '{$this->params['job_id']}'")); > > $subs = > $this->Ticket->Job->JobSubCombination->findAll("JobSubCombination.job_id = > {$this- > >params['job_id']}",'Subcontractor.id, Subcontractor.legal_name'); > > $sublist = array(); > foreach ($subs as $s) { > $sublist[$s['Subcontractor']['id']] = > $s['Subcontractor'] > ['legal_name']; > } > $this->set('sublist', $sublist); > $this->set('typelist', $this->typelist); > $this->set('chosentype', $type); > $this->set('chosensub', $sub); > > Open to thoughts... --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---