Login | Register
My pages Projects Community openCollabNet

Discussions > dev > RE: [propel-dev] PropelResultset Iterator

Discussion topic

Back to topic list

RE: [propel-dev] PropelResultset Iterator


Author Sven Tietje <tietje at topconcepts dot de>
Full name Sven Tietje <tietje at topconcepts dot de>
Date 2006-10-04 07:48:00 PDT
Message Alan Pinstein wrote:

hi alan,

> Eeeew. FETCH_INTO sounds awful. I cringe at the idea of how
> many bugs
> this causes with people not understanding references enough and
> having FETCH_INTO cause terrible problems. It's 2006, we don't need
> to re-use object shells! That is so not OO I don't even know how to
> express it.
> FETCH_INTO seems like some odd hack around GC unless I am not seeing
> something.
> Why is it needed?

Ok... You are not a friend of FETCH_INTO - just mentioned it for reading and
as possible option. If you know what it means: use it, where you need.

By default propel should create a new instance for each row.

> print "Querying for all properties to geocode...";
> $c = new Criteria;
> $c->add(MlsPrope​rtyPeer::GEOCODE_SCO​RE, 0); // only encode non-scored
> items
> $allPropsRS = MlsPropertyPeer::doS​electRS($c);
> print "Done!\n";

> $rowCount = 0;
> $propArr = array();
> while ($allPropsRS->next()) {
> $prop = new MlsProperty;
> $prop->hydrate($allPropsRS);
> // do stuff
> $rowCount++;
> }

Yes, of course it works, but i`m a friend of comfort :D Having a resultset
and option to set is nice :D

$rs = MlsPropertyPeer::doSelect($c);
// now just wanna read with some special calculation functions
$rs->setMode(Pro​pel::ONE_OBJECT /*FETCH_INTO*/);

foreach ($rs as $row) {
    //do stuff

Of course, the iterator can work internally the way you mentioned above.

Was just an idea to discuss. What do you think of using FETCH_CLASS?

Alan, i am not against your hydrate-method - just wanna discuss the
implementation of pdo-features.

Greets sven

« Previous message in topic | 7 of 26 | Next message in topic »


Show all messages in topic

                 Re: [propel-dev] PropelResultset Iterator Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2006-10-04 08:13:23 PDT
Page: of 2 « Previous | Next »
Messages per page: