Login | Register
My pages Projects Community openCollabNet

propel
Reply to message

* = Required fields
* Subject
* Body
Attachments
Send reply to
Topic
Author (directly in email)
Please type the letters in the image above.

Original message

Author Sven Tietje <mail@sven-tietje.de>
Full name Sven Tietje <mail@sven-tietje.de>
Date 2006-10-04 12:26:37 PDT
Message Alan Pinstein schrieb:
> Yeah, I don't get it either.
>
> Right now, if you use XXXPeer::doSelect() you get an array with all
> objects populated. If you plan on using *all* of the objects in the
> result set, then it doesn't improve performance to hydrate them
> on-demand; it just changes WHERE the cycles happen, but this doesn't
> matter, because the overall performance won't change..
yes, it just one iteration over the resultset, that you do later on -
thats true! you are absolutely right. sometimes, you have to iterator
twice or three times over one resultset (different places of output,
logical iterator). creating them on the first iteration will save one
foreach - don`t laugh!!! :-)

somestimes, you iterator over a resultset and set values. later on in
your application, you iterate again over the resultset and want to do
something and to save your objects. a caching is need to make compatible
to older versions:

$rs = XXXXPeer::doSelect();

$rs[0]->setName('test'); // object#1
$rs[1] //object#2
... your application....

$rs[0]->getName(); // object#1
$rs[0]->setFirst​Name('test2'); should always work on the same object
instance.

but sometimes, you habe to iterate once - then caching should / can be
disabled:
$rs = XXXXPeer::doSelect(Criteria, Propel::NO_CACHING);
$rs[0] // object #1
later on again would result in:
$rs[0] // object #2 ()

i just want to have one resultset having the functions of the actual
array propel gives to me, but also the possibilty to do the "real
iterate way" to save memory. for the last variant my idea was to use
FETCH_INTO, but alan convineced me: "the only overhead is __construct"
(when you real can call it overhead :-))