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
ec195360
Commit
ec195360
authored
Sep 17, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed `yii\mongodb\Collection::buildInCondition()` handles non-sequent key arrays
parent
7669689f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
CHANGELOG.md
extensions/mongodb/CHANGELOG.md
+1
-0
Collection.php
extensions/mongodb/Collection.php
+1
-1
QueryRunTest.php
tests/unit/extensions/mongodb/QueryRunTest.php
+26
-0
No files found.
extensions/mongodb/CHANGELOG.md
View file @
ec195360
...
...
@@ -6,6 +6,7 @@ Yii Framework 2 mongodb extension Change Log
-
Bug #2337:
`yii\mongodb\Collection::buildLikeCondition()`
fixed to escape regular expression (klimov-paul)
-
Bug #3385: Fixed "The 'connected' property is deprecated" (samdark)
-
Bug #4879: Fixed
`yii\mongodb\Collection::buildInCondition()`
handles non-sequent key arrays (klimov-paul)
-
Enh #3520: Added
`unlinkAll()`
-method to active record to remove all records of a model relation (NmDimas, samdark, cebe)
-
Enh #3778: Gii generator for Active Record model added (klimov-paul)
-
Enh #3947: Migration support added (klimov-paul)
...
...
extensions/mongodb/Collection.php
View file @
ec195360
...
...
@@ -998,7 +998,7 @@ class Collection extends Object
}
else
{
$inValues
=
$values
[
$column
];
}
$result
[
$column
][
$operator
]
=
$inValues
;
$result
[
$column
][
$operator
]
=
array_values
(
$inValues
)
;
}
return
$result
;
...
...
tests/unit/extensions/mongodb/QueryRunTest.php
View file @
ec195360
...
...
@@ -210,4 +210,30 @@ class QueryRunTest extends MongoDbTestCase
->
all
(
$connection
);
$this
->
assertEquals
(
$rows
,
$rowsUppercase
);
}
/**
* @see https://github.com/yiisoft/yii2/issues/4879
*
* @depends testInCondition
*/
public
function
testInConditionIgnoreKeys
()
{
$connection
=
$this
->
getConnection
();
$query
=
new
Query
;
$rows
=
$query
->
from
(
'customer'
)
/*->where([
'name' => [
0 => 'name1',
15 => 'name5'
]
])*/
->
where
([
'in'
,
'name'
,
[
10
=>
'name1'
,
15
=>
'name5'
]])
->
all
(
$connection
);
$this
->
assertEquals
(
2
,
count
(
$rows
));
$this
->
assertEquals
(
'name1'
,
$rows
[
0
][
'name'
]);
$this
->
assertEquals
(
'name5'
,
$rows
[
1
][
'name'
]);
}
}
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