我有以下DQL查询:
$query = Doctrine_Query::create()
->select('p.genre')
->from('Profile p')
->where('sf_guard_user_id = ?', 11);
如果我使用$sql = $query->getSqlQuery();
返回SQL语法,我得到:
SELECT p.id AS p__id, p.genre AS p__genre FROM profile p WHERE (p.sf_guard_user_id = ?)
这不正常。它应该 11 而不是?:
SELECT p.id AS p__id, p.genre AS p__genre FROM profile p WHERE (p.sf_guard_user_id = 11)
如果我写:
$query = Doctrine_Query::create()
->select('p.genre')
->from('Profile p')
->where('sf_guard_user_id = ' . 11);
SQL语法是正确的。
通常DQL应该自动执行此操作。为什么不发生?
答案 0 :(得分:3)