2011-04-06 65 views
0

如果我使用關係進行沒有緩存的集合,我有1個查詢。通過緩存這個查詢分裂成許多小的查詢。Doctrine 1.2 getResultCache和Left加入

一個查詢:

$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

你需要添加到您的模型類:

//lib/model/Table.class.php 

class Table extends BaseTable{ 
    public function serializeReferences($bool=null) 
    { 
    return true; 
    } 
}