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?).


-- 




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to