我想在Extbase存儲庫中執行查詢,但它不返回任何結果。在Extbase存儲庫中執行純SQL查詢
這是我的語法,如果有人知道這個問題,請幫忙。
在存儲庫文件中;
public function getImages($uidOfCE, $pid) {
$query = $this->createQuery();
$query->statement('SELECT sf.identifier,sfm.title,sfr.description
FROM tt_content AS tc
LEFT JOIN sys_file_reference sfr ON sfr.`uid_foreign` = tc.uid
LEFT JOIN sys_file AS sf ON sf.`uid` = sfr.uid_local
LEFT JOIN sys_file_metadata AS sfm ON sfm.`file` = sf.uid
WHERE tc.uid = '.$uidOfCE.'
AND tc.pid='.$pid.'
AND tc.list_type = "myimage_gallery"
AND sfr.`deleted` = 0 AND sfr.`hidden`= 0
AND tc.`deleted` = 0 AND tc.`hidden`= 0 AND tc.sys_language_uid ='.$GLOBALS['TSFE']->sys_language_uid.'
AND sfr.fieldname = "tx_myext_images" AND sfr.tablenames = "tt_content"');
return $query->execute();
}
在控制器:
$myimagegalleries = $this->myimagegalleryRepository->getImages(
$uidOfCE, $this->cObj->data['pid']);
是否有可能創造extbase庫的自定義查詢?
願此鏈接你的幫助http://docs.typo3.org/typo3cms/ExtbaseFluidBook/6-Persistence/3-implement-individual-database-queries.html –