marknt Posted December 20, 2007 Share Posted December 20, 2007 Hello guys, I'm using symfony framework. How can I access the 'table2.fieldname' in my indexSuccess.php? I can't figure out how to use the getSfGuardUser() function. Maybe there's a way to access the 'table2.fieldname'? I have been searching the online doc but to no luck I couldn't find the solution I'm looking for. SQL Query SELECT gi.title, up.first_name, up.last_name, t.shirt_image FROM game_image gi LEFT JOIN user_profile up ON up.user_id = gi.user_id LEFT JOIN team t ON t.team_id = up.team_id action.class.php <?php $pager = new sfPropelPager('GameImage', ; $c = new Criteria(); $c->addJoin(GameImagePeer::USER_ID, UserProfilePeer::USER_ID, Criteria::LEFT_JOIN); $c->addJoin(UserProfilePeer::TEAM_ID, TeamPeer::TEAM_ID, Criteria::LEFT_JOIN); $pager->setCriteria($c); $pager->setPage($this->getRequestParameter('page', 1)); $pager->setPeerMethod('doSelect'); $pager->init(); $this->pager = $pager; ?> indexSuccess.php <?php foreach($pager->getResults() as $thumb){ ?> <?php echo $thumb->getTitle(); // table1 fieldname ?> <?php echo $thumb->getSfGuardUser()->getUserProfile()->getFirstName(); // table2 fieldname ?> <?php } ?> It returns an error Fatal error: Call to a member function getUserProfile() on a non-object in indexSuccess.php How can I solve this problem? :'( Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/82439-help-in-symfony-left-join-show-in-view-file/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.