Saturday, January 31, 2009

Re: __mergeHasMany causing EXTREMELY slow data retrieval

Hi Dan,

this isn't a major flaw in CakePHP, it's the price you pay for the
ease of development. Fortunately Cake allows you very easy access to
SQL itself if you need it - although you may end up having to do some
more "old school" management of your result set rather than having
cake turn everything into handy arrays for you.

It's also possible that you'll be able to get the data you want by
turning your find() call around. I think you might look at this as a
call on your OrderLineItem model rather than Order, so inside the
OrderLineItems Controller you could do this:

$this->OrderLineItem->recursive = -1;
$orderlineitems = $this->OrderLineItem->find('all',array
('contain'=>array('Order')));
$this->set( compact('orderlineitems') );

(or inside the model by skipping the "->OrderLineItem" bit)

That will be fast, and I think won't need any "merging".


You said you had simplifed your example so it might not work in which
case you really will have to do something like:

$this->Order->execute(' some kind of SQL in here ')

and manually manage the result set.

Hope that helps

Pete


On Jan 30, 4:47 pm, Dan <grip...@gmail.com> wrote:
> No one has feedback on this? It seems like a MAJOR issue if you can't
> load more than a few thousand rows from "has many" relationship tables.
--~--~---------~--~----~------------~-------~--~----~
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: