【发布时间】:2012-11-02 05:06:07
【问题描述】:
我正在尝试让“产品”页面显示特定用户的简介和图片。我拥有的代码在下面,但它不断拉动当前登录的用户的简介和图片,这不是我想要的。注销后,我会立即收到 Call to a member function getBlurb() on a non-object 错误消息。有没有办法调出特定用户的“模糊”和“图片”字段?
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();
}
【问题讨论】:
-
错误很明显,因为您正在检索当前用户。但是你想从哪里获得用户?似乎不是来自会议。
-
不,绝对不是当前用户。它将是汽车的“卖家”。我是否必须构建查询来拉取该用户?
标签: symfony-1.4 sfguard