Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
fb8498e0
Commit
fb8498e0
authored
Nov 20, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quick fix for bug found with many-to-many relation fetching and limit
parent
8ca0e1a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
Query.php
lib/Doctrine/Query.php
+8
-5
No files found.
lib/Doctrine/Query.php
View file @
fb8498e0
...
...
@@ -464,11 +464,12 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
return
$q
;
}
/**
* returns the built sql query
* builds the sql query from the given parameters and applies things such as
* column aggregation inheritance and limit subqueries if needed
*
* @param array $params an array of prepared statement params (needed only in mysql driver
* when limit subquery algorithm is used)
* @return string
* @return string
the built sql query
*/
public
function
getQuery
(
$params
=
array
())
{
if
(
empty
(
$this
->
parts
[
"select"
])
||
empty
(
$this
->
parts
[
"from"
]))
...
...
@@ -560,6 +561,8 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
* @return string the limit subquery
*/
public
function
getLimitSubquery
()
{
$k
=
array_keys
(
$this
->
tables
);
$table
=
$this
->
tables
[
$k
[
0
]];
...
...
@@ -583,15 +586,15 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
$subquery
.=
' FROM '
.
$table
->
getTableName
()
.
' '
.
$alias
;
foreach
(
$this
->
parts
[
'join'
]
as
$parts
)
{
foreach
(
$parts
as
$part
)
{
// preserve LEFT JOINs only if needed
if
(
substr
(
$part
,
0
,
9
)
===
'LEFT JOIN'
)
{
$e
=
explode
(
' '
,
$part
);
if
(
!
in_array
(
$e
[
3
],
$this
->
subqueryAliases
))
if
(
!
in_array
(
$e
[
3
],
$this
->
subqueryAliases
)
&&
!
in_array
(
$e
[
2
],
$this
->
subqueryAliases
)
)
continue
;
}
$subquery
.=
' '
.
$part
;
...
...
@@ -1126,7 +1129,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
$assocTableName
=
$asf
->
getTableName
();
if
(
!
$loadFields
||
$table
->
usesInheritanceMap
()
)
{
if
(
!
$loadFields
)
{
$this
->
subqueryAliases
[]
=
$assocTableName
;
}
$this
->
parts
[
"join"
][
$tname
][
$assocTableName
]
=
$join
.
$assocTableName
.
' ON '
.
$tname
.
'.'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment