2010-05-09 203 views
2

我创建了一个Doctrine_Query并执行它,但我想知道我可以传递给它的参数。学说查询()参数?

$q = Doctrine_Query::create() 
    ->select('cl.id, cl.name') 
    ->from('ContactList cl'); 

$contactLists = $q->execute($params, $hydrationMode); 

从API文档:

execute($params = array(), $hydrationMode = null) 

他们在哪里告诉我的PARAMS?还有水合模式。

好像我在文档中找不到任何东西。如果他们对所有事情都有参考,那就太好了。

感谢

回答

2

我beleive的PARAMS是结合到查询值的数组 - 类似于prepeared声明 - 例如:

$q = Doctrine_Query::create() 
    ->select('cl.id, cl.name') 
    ->from('ContactList cl') 
    ->where('cl.name = ?'); 

$q->execute(array('fayer')); 

水化模式是从水化器常数之一Doctrine_Core并确定结果集如何水合(数组,对象等)。如果需要,也可以编写custom hydrators