0
我嘗試此查詢轉換爲QueryBuilder的:Symfony的學說的QueryBuilder
SELECT *, landingpages_content.id as cid FROM `landingpages_content` LEFT JOIN content ON landingpages_content.content_id = content.id WHERE content.enabled = 1 AND landingpages_content.landingpage_id = ? ORDER BY landingpages_content.`order`
這是我的QueryBuilder代碼:
$queryBuilder
->select('*, landingpages_content.id as cid')
->from('landingpages_content', 'landingpages_content')
->leftJoin('landingpages_content.content_id', 'content.id', null)
->where('content.enabled = 1')
->andWhere('landingpages_content.landingpage_id = :id')
->setParameter('id', $id)
->orderBy('landingpages_content.`order`', 'ASC');
它返回
InvalidArgumentException:查詢生成器無法加入。
仍然是同樣的錯誤。 – user3320954
好吧,那很奇怪,我在Symfony代碼中找不到這樣的錯誤。你能指出這個異常拋出什麼代碼? –
它不是由symfony引起的。這是由[鏈接]造成的(https://github.com/whiteoctober/Pagerfanta/blob/master/src/Pagerfanta/Adapter/DoctrineDbalSingleTableAdapter.php) – user3320954