Yeah..
my table is near 1gb...
Something like 800mb or a little more...
Im doing something like this:
$data = $this->Model->find('all',array('conditions' => array('Model.ok' =>
1)));
foreach($data as $row) {
foreach($row as $key => $value) {
// here i call phpexcel (or the helper) to write the file.
}
}
My action is pretty much this...
Do you think if I break this process into pages can make it lighter?
--
Renato de Freitas Freire
[email protected]
On Fri, Nov 19, 2010 at 2:49 PM, AD7six <[email protected]> wrote:
>
>
> On Nov 19, 3:03 pm, Renato de Freitas Freire <[email protected]>
> wrote:
> > In my case, my client explicity asked for an 'excel export feature'.
> >
> > I tried to do it in csv, but he didnt like it.
> >
> > Exporting directly with a simple helper, I had the same results.
> > Just work if I increase the memory for php.
> >
> > Seems not to have another way to do it.
>
> There's (almost) always another way to do it.
>
> instead of (somewhere, you are, or something you are calling is, doing
> something like this)
>
> foreach($this->find() as $row) {
> }
> finished();
>
> you do
>
> $page = 1
> while($data = $this->find('all', array('limit' => 100, 'page' =>
> $page)) {
> foreach($data as $row) {
> }
> $page++;
> doneablobofwork();
> }
> finished();
>
> needing 1.5gb of memory to write a file - unless the file is 1.5gb and
> even then it's ridiculous to have the full contents in memory - is
> just obscene.
>
> IMO,
>
> AD
>
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>For
> more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
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 [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