/** * Retrieve comments with author and profile * * @todo: table aliases :-) * */ public function getCommentsWithAuthor($culture = null) { if($culture === null) { $culture = sfContext::getInstance()->getUser()->getCulture(); } $query = new Doctrine_Query(); $comments = $query->from('LocationComment') ->from('LocationComment.author, LocationComment.LocationCommentI18n, LocationComment.author.profile') ->where('LocationComment.LocationCommentI18n.culture = ? AND LocationComment.id = ?', array($culture, $this->getId())) ->orderBy('LocationComment.created_at desc') ->execute(); return $comments; } // in my template: getCommentsWithAuthor(); ?> getAuthor(); ?> getProfile(); ?>