如何在Symfony 2中运行普通的mysql查询?

时间:2012-09-19 09:31:51

标签: php mysql symfony

如何在Symfony 2中运行普通的mysql查询,就像这样:

$query = $this->db->run('select * from table');
$rs = $this->db->fetchAll($query);

foreach($rs as $r) {
    ...
}

1 个答案:

答案 0 :(得分:1)

通过一些例子很好地解释了如何做到这一点:

http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/native-sql.html