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
319b645d
Commit
319b645d
authored
Nov 05, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #221
parent
bd776a68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
Query.php
lib/Doctrine/Query.php
+12
-7
No files found.
lib/Doctrine/Query.php
View file @
319b645d
...
...
@@ -187,31 +187,36 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
/**
* count
*
* @param array $params
* @return integer
*/
public
function
count
(
Doctrine_Table
$table
,
$params
=
array
())
{
public
function
count
(
$params
=
array
())
{
$this
->
remove
(
'select'
);
$join
=
$this
->
join
;
$where
=
$this
->
where
;
$having
=
$this
->
having
;
$table
=
reset
(
$this
->
tables
);
$q
=
'SELECT COUNT(DISTINCT '
.
$this
->
getShortAlias
(
$table
->
getTableName
())
.
'.'
.
$table
->
getIdentifier
()
.
') FROM '
.
$table
->
getTableName
()
.
' '
.
$this
->
getShortAlias
(
$table
->
getTableName
);
$q
=
"SELECT COUNT(DISTINCT "
.
$table
->
getTableName
()
.
'.'
.
$table
->
getIdentifier
()
.
") FROM "
.
$table
->
getTableName
()
.
" "
;
foreach
(
$join
as
$j
)
{
$q
.=
' '
.
implode
(
" "
,
$j
);
$q
.=
' '
.
implode
(
' '
,
$j
);
}
$string
=
$this
->
applyInheritance
();
if
(
!
empty
(
$where
))
{
$q
.=
" WHERE "
.
implode
(
" AND "
,
$where
);
$q
.=
' WHERE '
.
implode
(
' AND '
,
$where
);
if
(
!
empty
(
$string
))
$q
.=
" AND ("
.
$string
.
")"
;
$q
.=
' AND ('
.
$string
.
')'
;
}
else
{
if
(
!
empty
(
$string
))
$q
.=
" WHERE ("
.
$string
.
")"
;
$q
.=
' WHERE ('
.
$string
.
')'
;
}
if
(
!
empty
(
$having
))
$q
.=
" HAVING "
.
implode
(
' AND '
,
$having
);
$q
.=
' HAVING '
.
implode
(
' AND '
,
$having
);
$a
=
$this
->
getConnection
()
->
execute
(
$q
,
$params
)
->
fetch
(
PDO
::
FETCH_NUM
);
return
$a
[
0
];
...
...
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