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
12f9180b
Commit
12f9180b
authored
Nov 08, 2014
by
Paul Klimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Method 'oneWithModify' renamed to 'modify' at `yii\mongodb\Query`
parent
33c16380
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
ActiveQuery.php
extensions/mongodb/ActiveQuery.php
+2
-2
Query.php
extensions/mongodb/Query.php
+1
-1
ActiveRecordTest.php
tests/unit/extensions/mongodb/ActiveRecordTest.php
+2
-2
QueryRunTest.php
tests/unit/extensions/mongodb/QueryRunTest.php
+3
-3
No files found.
extensions/mongodb/ActiveQuery.php
View file @
12f9180b
...
...
@@ -169,9 +169,9 @@ class ActiveQuery extends Query implements ActiveQueryInterface
* Depending on the setting of [[asArray]], the query result may be either an array or an ActiveRecord object.
* Null will be returned if the query results in nothing.
*/
public
function
oneWithM
odify
(
$update
,
$options
=
[],
$db
=
null
)
public
function
m
odify
(
$update
,
$options
=
[],
$db
=
null
)
{
$row
=
parent
::
oneWithM
odify
(
$update
,
$options
,
$db
);
$row
=
parent
::
m
odify
(
$update
,
$options
,
$db
);
if
(
$row
!==
null
)
{
$models
=
$this
->
populate
([
$row
]);
return
reset
(
$models
)
?:
null
;
...
...
extensions/mongodb/Query.php
View file @
12f9180b
...
...
@@ -205,7 +205,7 @@ class Query extends Component implements QueryInterface
* @param Connection $db the Mongo connection used to execute the query.
* @return array|null the original document, or the modified document when $options['new'] is set.
*/
public
function
oneWithM
odify
(
$update
,
$options
=
[],
$db
=
null
)
public
function
m
odify
(
$update
,
$options
=
[],
$db
=
null
)
{
$collection
=
$this
->
getCollection
(
$db
);
if
(
!
empty
(
$this
->
orderBy
))
{
...
...
tests/unit/extensions/mongodb/ActiveRecordTest.php
View file @
12f9180b
...
...
@@ -264,14 +264,14 @@ class ActiveRecordTest extends MongoDbTestCase
$this
->
assertEquals
(
7
,
$rowRefreshed
->
status
);
}
public
function
test
FindOneWith
Modify
()
public
function
testModify
()
{
$searchName
=
'name7'
;
$newName
=
'new name'
;
$customer
=
Customer
::
find
()
->
where
([
'name'
=>
$searchName
])
->
oneWithM
odify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
true
]);
->
m
odify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
true
]);
$this
->
assertTrue
(
$customer
instanceof
Customer
);
$this
->
assertEquals
(
$newName
,
$customer
->
name
);
}
...
...
tests/unit/extensions/mongodb/QueryRunTest.php
View file @
12f9180b
...
...
@@ -211,7 +211,7 @@ class QueryRunTest extends MongoDbTestCase
$this
->
assertEquals
(
$rows
,
$rowsUppercase
);
}
public
function
test
OneWith
Modify
()
public
function
testModify
()
{
$connection
=
$this
->
getConnection
();
...
...
@@ -221,14 +221,14 @@ class QueryRunTest extends MongoDbTestCase
$newName
=
'new name'
;
$row
=
$query
->
from
(
'customer'
)
->
where
([
'name'
=>
$searchName
])
->
oneWithM
odify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
false
],
$connection
);
->
m
odify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
false
],
$connection
);
$this
->
assertEquals
(
$searchName
,
$row
[
'name'
]);
$searchName
=
'name7'
;
$newName
=
'new name'
;
$row
=
$query
->
from
(
'customer'
)
->
where
([
'name'
=>
$searchName
])
->
oneWithM
odify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
true
],
$connection
);
->
m
odify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
true
],
$connection
);
$this
->
assertEquals
(
$newName
,
$row
[
'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