如果我在没有缓存的情况下使用关系进行收集,那么我有1个查询。通过缓存,此查询会分成许多小查询。
一个查询:
$foobars = Doctrine_Query::create()
->from('Project_Model_Table table')
->leftJoin('table.Table1 table1')
->leftJoin('table1.Table2 table2')
->leftJoin('table.Table3 table3')
->leftJoin('table3.Table4 as table4')
->orderBy('table.created DESC')
->execute();
非常小的选择查询:
$foobars = Doctrine_Query::create()
->from('Project_Model_Table table')
->leftJoin('table.Table1 table1')
->leftJoin('table1.Table2 table2')
->leftJoin('table.Table3 table3')
->leftJoin('table3.Table4 as table4')
->orderBy('table.created DESC')
->useResultCache(true)
->execute();
答案 0 :(得分:0)
您需要将其添加到模型类中:
//lib/model/Table.class.php
class Table extends BaseTable{
public function serializeReferences($bool=null)
{
return true;
}
}