$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?
doSelectRS errors:
PHP Fatal error: Call to undefined method RoutesPeer::doselectrs()
in /apps/frontend/modules/route/actions/actions.class.php on line 39
doSelectStmt returns the query:
PDOStatement Object ( [queryString] => SELECT routes.ID, routes.TITLE,
routes.DESCRIPTION, routes.MILES, routes.DIFFICULTY, routes.TIME,
routes.ZIP_CODE, routes.USER_ID, routes.SITEID, routes.CREATED_AT,
routes.UPDATED_AT, ((ACOS(SIN(40.73022 * PI() / 180) * SIN
(`zipcodes`.LAT * PI() / 180) + COS(40.73022 * PI() / 180) * COS
(`zipcodes`.LAT * PI() / 180) * COS((73.9885 - `zipcodes`.LON) * PI
() / 180)) * 180 / PI()) * 60 * 1.1515) AS distance FROM `routes`,
`zipcodes` WHERE zipcodes.ZIPCODE=routes.ZIP_CODE ORDER BY distance
ASC LIMIT 10 )
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---