0

如果我在不缓存的情况下使用关系进行收集,我有 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();
4

1 回答 1

0

您需要将此添加到您的模型类中:

//lib/model/Table.class.php

class Table extends BaseTable{
  public function serializeReferences($bool=null)
  {
   return true;
  }
}
于 2011-06-28T18:31:40.040 回答