Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
PSDI Army
yii2
Commits
8250cfbb
Commit
8250cfbb
authored
Nov 14, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverted change of count() signature
parent
1acdbb74
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
6 deletions
+7
-6
ActiveRelationTrait.php
framework/yii/ar/ActiveRelationTrait.php
+1
-1
ActiveDataProvider.php
framework/yii/data/ActiveDataProvider.php
+1
-1
Query.php
framework/yii/db/Query.php
+3
-3
QueryInterface.php
framework/yii/db/QueryInterface.php
+2
-1
No files found.
framework/yii/ar/ActiveRelationTrait.php
View file @
8250cfbb
...
...
@@ -33,7 +33,7 @@ trait ActiveRelationTrait
* @var array the columns of the primary and foreign tables that establish the relation.
* The array keys must be columns of the table for this relation, and the array values
* must be the corresponding columns from the primary table.
* Do not prefix or quote the column names as th
ey
will be done automatically by Yii.
* Do not prefix or quote the column names as th
is
will be done automatically by Yii.
*/
public
$link
;
/**
...
...
framework/yii/data/ActiveDataProvider.php
View file @
8250cfbb
...
...
@@ -158,7 +158,7 @@ class ActiveDataProvider extends BaseDataProvider
throw
new
InvalidConfigException
(
'The "query" property must be an instance of a class that implements the QueryInterface e.g. yii\db\Query or its subclasses.'
);
}
$query
=
clone
$this
->
query
;
return
(
int
)
$query
->
limit
(
-
1
)
->
offset
(
-
1
)
->
orderBy
([])
->
count
(
$this
->
db
);
return
(
int
)
$query
->
limit
(
-
1
)
->
offset
(
-
1
)
->
orderBy
([])
->
count
(
'*'
,
$this
->
db
);
}
/**
...
...
framework/yii/db/Query.php
View file @
8250cfbb
...
...
@@ -179,13 +179,13 @@ class Query extends Component implements QueryInterface
/**
* Returns the number of records.
* @param Connection $db the database connection used to generate the SQL statement.
* If this parameter is not given (or null), the `db` application component will be used.
* @param string $q the COUNT expression. Defaults to '*'.
* Make sure you properly quote column names in the expression.
* @param Connection $db the database connection used to generate the SQL statement.
* If this parameter is not given (or null), the `db` application component will be used.
* @return integer number of records
*/
public
function
count
(
$
db
=
null
,
$q
=
'*'
)
public
function
count
(
$
q
=
'*'
,
$db
=
null
)
{
$this
->
select
=
[
"COUNT(
$q
)"
];
return
$this
->
createCommand
(
$db
)
->
queryScalar
();
...
...
framework/yii/db/QueryInterface.php
View file @
8250cfbb
...
...
@@ -44,11 +44,12 @@ interface QueryInterface
/**
* Returns the number of records.
* @param string $q the COUNT expression. Defaults to '*'.
* @param Connection $db the database connection used to execute the query.
* If this parameter is not given, the `db` application component will be used.
* @return integer number of records
*/
public
function
count
(
$db
=
null
);
public
function
count
(
$
q
=
'*'
,
$
db
=
null
);
/**
* Returns a value indicating whether the query result contains any row of data.
...
...
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