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
8032785f
Commit
8032785f
authored
Dec 06, 2013
by
Paul Klimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Method "\yii\mogo\Collection::buildLikeCondition()" fixed to use \MongoRegex.
parent
380d1d02
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
Collection.php
extensions/mongo/Collection.php
+5
-1
QueryRunTest.php
tests/unit/extensions/mongo/QueryRunTest.php
+13
-0
No files found.
extensions/mongo/Collection.php
View file @
8032785f
...
@@ -907,6 +907,9 @@ class Collection extends Object
...
@@ -907,6 +907,9 @@ class Collection extends Object
throw
new
InvalidParamException
(
"Operator '
$operator
' requires two operands."
);
throw
new
InvalidParamException
(
"Operator '
$operator
' requires two operands."
);
}
}
list
(
$column
,
$value
)
=
$operands
;
list
(
$column
,
$value
)
=
$operands
;
return
[
$column
=>
'/'
.
$value
.
'/'
];
if
(
!
(
$value
instanceof
\MongoRegex
))
{
$value
=
new
\MongoRegex
(
$value
);
}
return
[
$column
=>
$value
];
}
}
}
}
\ No newline at end of file
tests/unit/extensions/mongo/QueryRunTest.php
View file @
8032785f
...
@@ -129,4 +129,16 @@ class QueryRunTest extends MongoTestCase
...
@@ -129,4 +129,16 @@ class QueryRunTest extends MongoTestCase
->
all
(
$connection
);
->
all
(
$connection
);
$this
->
assertEquals
(
1
,
count
(
$rows
));
$this
->
assertEquals
(
1
,
count
(
$rows
));
}
}
public
function
testLike
()
{
$connection
=
$this
->
getConnection
();
$query
=
new
Query
;
$rows
=
$query
->
from
(
'customer'
)
->
where
([
'LIKE'
,
'name'
,
'/me1/'
])
->
all
(
$connection
);
$this
->
assertEquals
(
2
,
count
(
$rows
));
$this
->
assertEquals
(
'name1'
,
$rows
[
0
][
'name'
]);
$this
->
assertEquals
(
'name10'
,
$rows
[
1
][
'name'
]);
}
}
}
\ No newline at end of file
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