views:

202

answers:

1

I am messing around with Doctrine (version 1.0.3) to see if would make a good fit for the collection of apps I am writing.

I am trying to do a query and return only 3 fields. I am getting the correct fields in one table, but the join table I am getting everything when I only want one field. I have written out the what the SQL should be in phpMyAdmin and it returns only what I need.

 31 $ftp_info = Doctrine_Query::create()
 32          ->select('f.uid, f.home, s.identifier')
 33          ->from('FtpUser f')
 34          ->leftJoin('f.Submitter s')
 35          ->where('f.uid = ?',500)
 36          ->execute();
 37
 38 print $ftp_info[0]->uid ."\n";
 39 print $ftp_info[0]->home ."\n";
 40 print $ftp_info[0]->Submitter->description ."\n";
 41 print $ftp_info[0]->Submitter->identifier ."\n";

It gives me a value for description when I did not ask for it in the query. These two tables have a one-to-one relationship defined in the appropriate setUp methods.

Any clues to what I am missing?

+2  A: 

I think it will lazy-load that field from the database automatically as you request it. See here

You could maybe var_dump() the result to confirm this

Tom Haigh
The var_dump seems to be infinite, but you are right that is what's happening. I new it lazy loaded the classes, but not fields like that. Thanks!
Chris Kloberdanz