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 <tietje@topconcepts.de>
Full name Sven Tietje <tietje@topconcepts.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