symfony 1.4 Doctrine fetchOne返回数组

fetchOne($params,$hydrationMode);默认返回为对象,返回数组使用Doctrine::HYDRATE_ARRAY

$user = $q->where('id=?')
  ->fetchOne(array(1))
  ->toArray();

等同于:
$user = $q->where('id=?')
  ->fetchOne(array(1),Doctrine::HYDRATE_ARRAY);
等同于:
$user = $q->where('id=?',array(1))
  ->setHydrationMode(Doctrine::HYDRATE_ARRAY)
  ->fetchoOne();

											
This entry was posted in Doctrine, Uncategorized. Bookmark the permalink.

Comments are closed.