Damn, "Call to undefined method RoutesPeer::doselectrs()" and
"PDOStatement Object", i didn't see (read) that.
This point goes to you ;o)

It's definitively "doSelectStmt" time!

Michael


On 28 Feb., 13:13, vadim <[email protected]> wrote:
> Yeah, but read an error he's facing:
>
> PHP Fatal error:  Call to undefined method RoutesPeer::doselectrs()
> in /apps/frontend/modules/route/actions/actions.class.php on line 39
>
> So I've made the conclusion that he uses Propel 1.3.
>
> Joshua, 1 000 000 dollars question to you:
>
> What Propel version do you use? ;)
>
> On Feb 28, 2:39 pm, "[email protected]"
>
> <[email protected]> wrote:
> > Yes i'm aware of that and i know the difference between 1.2 and 1.3.
> > But Joshua mentioned doSelectRS in his second post, so i assume he's
> > using propel 1.2
>
> > For propel 1.3 it is doSelectStmt, you're right.
>
> > Michael
>
> > On 28 Feb., 10:34, vadim <[email protected]> wrote:
>
> > > Michael, I guess the code you wrote wouldn't work in Propel1.3. As far
> > > as I'm concerned doSelectRS is not a case in Propel 1.3 anymore. One
> > > should use doSelectStmt instead. If I were you I would try right that:
>
> > >     $c = new Criteria();
>
> > >     $c->clearSelectColumns();
>
> > >     $c->addSelectColumn( '((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) as distance'); //Jesus Christ!
>
> > >   $sum = RoutesPeer::doSelectStmt($c);
>
> > >   $total = array();
>
> > >   while ($row = $sum->fetch(PDO::FETCH_NUM)) {
> > >      $total[] = array(
> > >      'distance' => $row[0],
> > >     //some other columns...
> > >   );
>
> > > On Feb 28, 11:21 am, "[email protected]"
>
> > > <[email protected]> wrote:
> > > > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to