0

キャッシュなしでコレクションにリレーションを使用すると、クエリが 1 つになります。キャッシュを使用すると、このクエリは多数の小さなクエリに分割されます。

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 に答える