在我的控制器中,我使用数组格式的doctrine从db获取值。数组看起来像这样
Array(
[0] => Admin_Model_prod Object
(
[_id:protected] => 1
[_pname:protected] => mobile
[_categoryname:protected] => device
[_price:protected] => 10000
[_status:protected] => sold
)
[1] => Admin_Model_prod Object
(
[_id:protected] => 2
[_pname:protected] => tv
[_categoryname:protected] => device
[_price:protected] => 50000
[_status:protected] => sold
)
)
现在我想显示id = 1 ..
的值任何建议请
答案 0 :(得分:1)
$userId = Doctrine_Query::create()
->select('o.authorId')
->from("Offer o")
->where("o.id =$offerId")
->fetchArray();
像这样使用您的查询。你会得到一个数组而不是对象