【发布时间】:2014-12-20 10:05:54
【问题描述】:
我正在尝试学说中的原生查询(真正的原生)。
public function recupererNoms()
{
$sql = 'SELECT id, nom FROM table;';
$stmt = $this->getEntityManager()->getConnection()->prepare($sql);
$stmt->execute();
return $stmt->fetchAll();
}
此查询返回:
array(4) { ["id"]=> string(1) "1" [0]=> string(1) "1" ["nom"]=> string(4) "toto" [1]=> string(4) "toto" }
信息在此返回的表中以某种方式重复。例如,在我的 sql 请求中,我指定了名称并得到了["nom"]=> string(4) "toto" [1]=> string(4) "toto"。如何摆脱 [1]=> string(4) "toto" 和 ["id"]=> string(1) "1" [0]=> string(1) "1" ?
【问题讨论】:
标签: symfony doctrine-orm