Details
-
Type:
Bug
-
Status:
Reopened
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: 1.2.0
-
Component/s: None
-
Labels:None
-
Environment:Linux, Oracle 10g
Description
Doctrine generates the following invalid subquery if oracle adapter is used (same query is generated corret if pdo_oci is used):
SELECT DISTINCT "s2"."code"
FROM "spend_category" "s2"
INNER JOIN "company_spend_category" "c4" ON ("s2"."code" = "c4"."spendcategory_code")
INNER JOIN "company" "c3" ON "c3"."code" = "c4"."company_code"
WHERE "s2"."code" = '19000000'
AND "c3"."is_deleted" IS NOT NULL
AND "s2"."is_deleted" IS NOT NULL
ORDER BY "c3"."name" desc
The problem is that the order by column is not part of the selected columns.
Sample dql statement to reproduce this error:
$this->pageAllPager = new Doctrine_Pager(
$q = Doctrine_Query::create()
->select('c.code, c.name, c.is_activated, c.is_deleted, sc.code')
->from('SpendCategory sc')
->innerJoin('sc.Companies c')
->where("sc.code = '$spendcategory'")
->addWhere('c.is_deleted IS NOT NULL')
->addWhere('sc.is_deleted IS NOT NULL')
->orderBy($orderBy)
->setHydrationMode(Doctrine::HYDRATE_ARRAY),
$page,
$resultsPerPage);
}
I'll leave this open if someone runs across the same problem, a test case showing the issue would help with pin pointing the problem area in the code.