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
5a046230
Commit
5a046230
authored
Dec 09, 2013
by
Paul Klimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Translating SQL-like syntax into Mongo syntax removed from "\yii\mongodb\Collection".
parent
8a3277e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
25 deletions
+3
-25
Collection.php
extensions/mongodb/Collection.php
+3
-25
No files found.
extensions/mongodb/Collection.php
View file @
5a046230
...
...
@@ -651,7 +651,7 @@ class Collection extends Object
}
/**
* Converts
user friendly
condition keyword into actual Mongo condition keyword.
* Converts
"\yii\db\*" quick
condition keyword into actual Mongo condition keyword.
* @param string $key raw condition key.
* @return string actual key.
*/
...
...
@@ -659,25 +659,8 @@ class Collection extends Object
{
static
$map
=
[
'OR'
=>
'$or'
,
'>'
=>
'$gt'
,
'>='
=>
'$gte'
,
'<'
=>
'$lt'
,
'<='
=>
'$lte'
,
'!='
=>
'$ne'
,
'<>'
=>
'$ne'
,
'IN'
=>
'$in'
,
'NOT IN'
=>
'$nin'
,
'ALL'
=>
'$all'
,
'SIZE'
=>
'$size'
,
'TYPE'
=>
'$type'
,
'EXISTS'
=>
'$exists'
,
'NOTEXISTS'
=>
'$exists'
,
'ELEMMATCH'
=>
'$elemMatch'
,
'MOD'
=>
'$mod'
,
'%'
=>
'$mod'
,
'='
=>
'$$eq'
,
'=='
=>
'$$eq'
,
'WHERE'
=>
'$where'
];
$matchKey
=
strtoupper
(
$key
);
if
(
array_key_exists
(
$matchKey
,
$map
))
{
...
...
@@ -759,7 +742,6 @@ class Collection extends Object
{
$result
=
[];
foreach
(
$condition
as
$name
=>
$value
)
{
$name
=
$this
->
normalizeConditionKeyword
(
$name
);
if
(
strncmp
(
'$'
,
$name
,
1
)
===
0
)
{
// Native Mongo condition:
$result
[
$name
]
=
$value
;
...
...
@@ -769,12 +751,8 @@ class Collection extends Object
// Quick IN condition:
$result
=
array_merge
(
$result
,
$this
->
buildInCondition
(
'IN'
,
[
$name
,
$value
]));
}
else
{
// Normalize possible verbose condition:
$actualValue
=
[];
foreach
(
$value
as
$k
=>
$v
)
{
$actualValue
[
$this
->
normalizeConditionKeyword
(
$k
)]
=
$v
;
}
$result
[
$name
]
=
$actualValue
;
// Mongo complex condition:
$result
[
$name
]
=
$value
;
}
}
else
{
// Direct match:
...
...
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