I'm trying to have a "product" page display a specific user's blurb and picture. The code I have is below but it keeps pulling the currently logged on user's blurb and picture which is not what I want. As soon as I log out, I get the Call to a member function getBlurb() on a non-object
error message. Is there a way to pull up a specific user's "blurb" and "Picture" fields?
public function executeShow(sfWebRequest $request)
{
$this->car = $this->getRoute()->getObject();
$seller_id = $this->car->getSeller_id();
$this->seller = $this->getUser()->getGuardUser($seller_id);
$this->blurb = $this->seller->getBlurb();
$this->picture = $this->seller->getPicture();
}
$this->seller
is not an object because $this->getUser()->getGuardUser($seller_id);
don't accept any parameters, it only retrieves current user. Look at that method definition at sfGuardSecurityUser
.
You have to do it like:
Doctrine: $this->seller = $this->car->getSeller();
Propel: $this->seller = SfGuardUserPeer::retrieveByPK($seller_id);