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
da000165
Commit
da000165
authored
Nov 07, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Method 'oneWithUpdate' renamed to 'oneWithModify' at `yii\mongodb\Query`
parent
b819a678
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 @
da000165
...
...
@@ -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
oneWith
Update
(
$update
,
$options
=
[],
$db
=
null
)
public
function
oneWith
Modify
(
$update
,
$options
=
[],
$db
=
null
)
{
$row
=
parent
::
oneWith
Update
(
$update
,
$options
,
$db
);
$row
=
parent
::
oneWith
Modify
(
$update
,
$options
,
$db
);
if
(
$row
!==
null
)
{
$models
=
$this
->
populate
([
$row
]);
return
reset
(
$models
)
?:
null
;
...
...
extensions/mongodb/Query.php
View file @
da000165
...
...
@@ -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
oneWith
Update
(
$update
,
$options
=
[],
$db
=
null
)
public
function
oneWith
Modify
(
$update
,
$options
=
[],
$db
=
null
)
{
$collection
=
$this
->
getCollection
(
$db
);
if
(
!
empty
(
$this
->
orderBy
))
{
...
...
tests/unit/extensions/mongodb/ActiveRecordTest.php
View file @
da000165
...
...
@@ -264,14 +264,14 @@ class ActiveRecordTest extends MongoDbTestCase
$this
->
assertEquals
(
7
,
$rowRefreshed
->
status
);
}
public
function
testFindOneWith
Update
()
public
function
testFindOneWith
Modify
()
{
$searchName
=
'name7'
;
$newName
=
'new name'
;
$customer
=
Customer
::
find
()
->
where
([
'name'
=>
$searchName
])
->
oneWith
Update
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
true
]);
->
oneWith
Modify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
true
]);
$this
->
assertTrue
(
$customer
instanceof
Customer
);
$this
->
assertEquals
(
$newName
,
$customer
->
name
);
}
...
...
tests/unit/extensions/mongodb/QueryRunTest.php
View file @
da000165
...
...
@@ -211,7 +211,7 @@ class QueryRunTest extends MongoDbTestCase
$this
->
assertEquals
(
$rows
,
$rowsUppercase
);
}
public
function
testOneWith
Update
()
public
function
testOneWith
Modify
()
{
$connection
=
$this
->
getConnection
();
...
...
@@ -221,14 +221,14 @@ class QueryRunTest extends MongoDbTestCase
$newName
=
'new name'
;
$row
=
$query
->
from
(
'customer'
)
->
where
([
'name'
=>
$searchName
])
->
oneWith
Update
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
false
],
$connection
);
->
oneWith
Modify
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
false
],
$connection
);
$this
->
assertEquals
(
$searchName
,
$row
[
'name'
]);
$searchName
=
'name7'
;
$newName
=
'new name'
;
$row
=
$query
->
from
(
'customer'
)
->
where
([
'name'
=>
$searchName
])
->
oneWith
Update
([
'$set'
=>
[
'name'
=>
$newName
]],
[
'new'
=>
true
],
$connection
);
->
oneWith
Modify
([
'$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