943,169 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 73
  • PHP RSS
Sep 3rd, 2010
0

Symfony Doctrine help

Expand Post »
Hi everybody,

I have some difficulties getting my objects mapped from a query.

My query is this one:
PHP Syntax (Toggle Plain Text)
  1. $this->myPlanes = Doctrine_Query::create()
  2. ->from('FsPlane p')
  3. ->leftJoin('p.FsPlanetech t')
  4. ->leftJoin('t.FsPicture')
  5. ->where('player_id = ?', $id)
  6. ->execute();

But when I want to retrieve my objects FsPicture I get something strange
code:
PHP Syntax (Toggle Plain Text)
  1. foreach ($myPlanes as $key => $iterPlane) {
  2. $picture = $iterPlane->FsPlanetech->getFsPicture();
  3.  
  4. }

$picture is a object(sfOutputEscaperIteratorDecorator)
Which is not what I want I just want my object from the db mapped.


My schema.yml
PHP Syntax (Toggle Plain Text)
  1.  
  2. FsPlane:
  3. actAs: { Timestampable: ~ }
  4. columns:
  5. id: { type: integer, notnull: true, autoincrement:true, primary:true }
  6. player_id: { type: integer, notnull: false }
  7. planetech_id: { type: integer, notnull: false }
  8. pilot_id: { type: integer, notnull: false, unique: true }
  9. copilot_id: { type: integer, notnull: false, unique: true }
  10. relations:
  11. FsPlayer: { onDelete: CASCADE, local: player_id, foreign: id }
  12. FsPlanetech: { onDelete: CASCADE, local: planetech_id, foreign: id }
  13. FsPilot: { onDelete: CASCADE, local: pilot_id, foreign: id, class: FsEmployee }
  14. FsCoPilot: { onDelete: CASCADE, local: copilot_id, foreign: id, class: FsEmployee }
  15.  
  16. FsPlanetech:
  17. actAs:
  18. columns:
  19. id: { type: integer, notnull: true, autoincrement:true, primary:true }
  20. manufacturer: { type: string(255), notnull: true }
  21. model: { type: string(255), notnull: true }
  22. type: { type: string(255), notnull: true }
  23. weight: { type: integer, notnull: true }
  24. maxweight: { type: integer, notnull: true }
  25. speed: { type: float, notnull: true }
  26. maxspeed: { type: float, notnull: true }
  27. landingspeed: { type: float, notnull: false }
  28. maxpassengers: { type: integer, notnull: true }
  29. nrofreactors: { type: integer, notnull: true }
  30. price: {type: integer, notnull: true }
  31.  
  32.  
  33. FsPicture:
  34. columns:
  35. id: { type: integer, notnull: true, autoincrement:true, primary:true }
  36. picture: { type: string(255) }
  37. plane: {type: integer }
  38. relations:
  39. FsPlanetech: {onDelete: CASCADE, local: plane, foreign: id}

Greetz
Nodoso
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nodoso is offline Offline
4 posts
since Apr 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC