doSelectRS is the right way to access an array.
Example from propel docs:
$rs = AuthorPeer::doSelectRS(new Criteria());
$names = array();
while($rs->next()) {
$names[] = $rs->getString(2);
}
Michael
On 28 Feb., 02:23, Joshua <[email protected]> wrote:
> On Feb 27, 6:51 pm, Eno <[email protected]> wrote:
>
>
>
> > On Fri, 27 Feb 2009, Joshua wrote:
> > > $c = new Criteria();
> > > $c->addAsColumn('distance', '((ACOS(SIN('.$zipcode->getLat().' * PI
> > > () / 180) * SIN(`zipcodes`.LAT * PI() / 180) + COS('.$zipcode->getLat
> > > ().' * PI() / 180) * COS(`zipcodes`.LAT * PI() / 180) * COS(('.
> > > $zipcode->getLon().' - `zipcodes`.LON) * PI() / 180)) * 180 / PI()) *
> > > 60 * 1.1515)');
> > > RoutesPeer::addSelectColumns($c);
> > > $c->setLimit(10);
> > > $c->addAscendingOrderByColumn('distance');
> > > $c->addJoin(ZipcodesPeer::ZIPCODE, RoutesPeer::ZIP_CODE);
> > > $this->featuredRoutes = RoutesPeer::doSelect($c);
>
> > > I need to be able to access "distance" column. The above code will
> > > give me an array of Routes objects but does not include the distance
> > > column.
>
> > > What can I do to access all the necessary columns including custom
> > > ones?
>
> > I think, if you're using raw SQL inside a peer class, you will have to
> > iterate through the rows and hydrate the objects yourself (I guess this
> > also means you need the model classes and schema as well right?).
>
> > --
>
> I thought there was a way to have propel return the exact values as a
> PHP array. Is that supposed to be done by doSelectRS maybe? It returns
> an error when I try to use it?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---