Login | Register
My pages Projects Community openCollabNet

Discussions > dev > PropelResultset Iterator

Discussion topic

Back to topic list

PropelResultset Iterator


Author Sven Tietje <tietje at topconcepts dot de>
Full name Sven Tietje <tietje at topconcepts dot de>
Date 2006-10-02 01:43:05 PDT
Message Hi,

i`d like to create a PropelResultset to make it possible to iterate over
Resultsets and to hydrate objects on the fly. We have talked about it.

One of propel`s performance problems are the Result-Arrays.

$resultArrray = TablePeer::doSelect(new Criteria());

doSelect queries the database. A Resultset is given. Now, Propel fetches
each row of the resultset, hydrates the row into an object and puts the
object into an array. Having fetched all rows, doSelect returns the

I think BasePeer should return a PropelResultset.

class PropelResultset implements IteratorAggregate, ArrayAccess,
Countable {
    public function setFetchMode();

    .... Interface - Methods

- ArrayAccess and Countable will make PropelResultset
backwards-compatible to the normal array.

- setFetchMode will give you two possiblities:

    1) PropelResultset::OBJECT - enabled by default
        foreach ($resultset as $item) {

    2) PropelResultset::ARRAY - sometimes you don`t need objects
        foreach ($resultset as $item) {
        Key of the $item - Array is of structure:
        tablename.columname or tablealias.columnname

Perhaps we also should discuss a BaseObject implementing ArrayAccess

« Previous message in topic | 1 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: