1
我有這個CakePHP的查找查詢:CakePHP的遞歸查找包括頂級車型再次
$results = $this->Instrument->find('all', array('recursive' => 2, 'conditions' => array('OR' => array('Instrument.name' => $tag_search, 'Instrument.nameEN' => $tag_search))));
示範儀器具有屬於許多Instrumentbox。我想找到一個Instrumentbox,它的所有樂器都用$tag_search
搜索一個樂器名稱。 它返回具有該儀器的Insrtumentboxes,但它不包含儀器中的所有儀器agaion。有沒有辦法告訴CakePHP的,這樣我得到的結構,再次加載「頂級模特」
$results = array(
0 => [
'Instrument' => [
'name' => "$tag_search value",
'...' => ...,
'Instrumentbox' => [
0 => [
'...' => '...', //everything else is properly included
'Instrument' => [...] //this is NOT included, how can I include it?
]
]
]
]
,當我和標籤搜索,所以在上面的「標籤」結構想象同樣的事情發生,而不是'樂器',那麼樂器包含在樂器中,但標籤不是。因此,「頂級模型」不再包含在結構中。我必須親手製作,還是可以製作cakephp呢? 在此先感謝!