Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
Project
Project
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
sinan
laravel-mongodb
Commits
c9333002
Commit
c9333002
authored
12 years ago
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preparing for laravel 4.1, fixes #60
parent
1089ee3b
master
2.0
2.1
2.2
2.3
4.2
develop
4.0.0-alpha.1
v3.6.4
v3.6.3
v3.6.2
v3.6.1
v3.6.0
v3.5.3
v3.5.2
v3.5.1
v3.5.0
v3.4.6
v3.4.5
v3.4.4
v3.4.3
v3.4.2
v3.4.1
v3.4.0
v3.3.1
v3.3.0
v3.3.0-alpha
v3.2.3
v3.2.2
v3.2.1
v3.2.0
v3.1.4
v3.1.3
v3.1.2
v3.1.1
v3.1.0
v3.1.0-alpha
v3.0.2
v3.0.1
v3.0.0
v3.0.0-beta
v3.0.0-alpha
v2.3.5
v2.3.4
v2.3.3
v2.3.2
v2.3.1
v2.3.0
v2.2.10
v2.2.9
v2.2.8
v2.2.7
v2.2.6
v2.2.5
v2.2.4
v2.2.3
v2.2.2
v2.2.1
v2.2.0
v2.1.9
v2.1.8
v2.1.7
v2.1.6
v2.1.5
v2.1.4
v2.1.3
v2.1.2
v2.1.1
v2.1.0
v2.1.0-beta
v2.0.5
v2.0.4
v2.0.3
v2.0.2
v2.0.1
v2.0.0
v2.0.0-alpha
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.3.2
v1.3.1
v1.3.0
v1.2.9
v1.2.8
v1.2.7
v1.2.6
v1.2.5
v1.2.4
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.1.4
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.8
v1.0.7
v1.0.6
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
8 deletions
+38
-8
composer.json
composer.json
+1
-1
phpunit.xml
phpunit.xml
+4
-0
Builder.php
src/Jenssegers/Mongodb/Builder.php
+29
-7
QueryTest.php
tests/QueryTest.php
+4
-0
No files found.
composer.json
View file @
c9333002
...
...
@@ -25,4 +25,4 @@
}
},
"minimum-stability"
:
"dev"
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
phpunit.xml
View file @
c9333002
...
...
@@ -23,5 +23,9 @@
<testsuite
name=
"cache"
>
<directory>
tests/CacheTest.php
</directory>
</testsuite>
<testsuite
name=
"builder"
>
<directory>
tests/QueryBuilderTest.php
</directory>
<directory>
tests/QueryTest.php
</directory>
</testsuite>
</testsuites>
</phpunit>
This diff is collapsed.
Click to expand it.
src/Jenssegers/Mongodb/Builder.php
View file @
c9333002
...
...
@@ -277,13 +277,14 @@ class Builder extends \Illuminate\Database\Query\Builder {
* @param string $column
* @param array $values
* @param string $boolean
* @return \Illuminate\Database\Query\Builder
* @param bool $not
* @return Builder
*/
public
function
whereBetween
(
$column
,
array
$values
,
$boolean
=
'and'
)
public
function
whereBetween
(
$column
,
array
$values
,
$boolean
=
'and'
,
$not
=
false
)
{
$type
=
'between'
;
$this
->
wheres
[]
=
compact
(
'column'
,
'type'
,
'boolean'
,
'values'
);
$this
->
wheres
[]
=
compact
(
'column'
,
'type'
,
'boolean'
,
'values'
,
'not'
);
return
$this
;
}
...
...
@@ -739,11 +740,32 @@ class Builder extends \Illuminate\Database\Query\Builder {
{
extract
(
$where
);
return
array
(
$column
=>
array
(
'$gte'
=>
$values
[
0
],
'$lte'
=>
$values
[
1
])
if
(
$not
)
{
return
array
(
'$or'
=>
array
(
array
(
$column
=>
array
(
'$lte'
=>
$values
[
0
]
)
),
array
(
$column
=>
array
(
'$gte'
=>
$values
[
1
]
)
)
)
);
}
else
{
return
array
(
$column
=>
array
(
'$gte'
=>
$values
[
0
],
'$lte'
=>
$values
[
1
]
)
);
}
}
protected
function
compileWhereRaw
(
$where
)
...
...
This diff is collapsed.
Click to expand it.
tests/QueryTest.php
View file @
c9333002
...
...
@@ -103,6 +103,10 @@ class QueryTest extends PHPUnit_Framework_TestCase {
$users
=
User
::
whereBetween
(
'age'
,
array
(
13
,
23
))
->
get
();
$this
->
assertEquals
(
2
,
count
(
$users
));
// testing whereNotBetween for version 4.1
$users
=
User
::
whereBetween
(
'age'
,
array
(
0
,
25
),
'and'
,
true
)
->
get
();
$this
->
assertEquals
(
6
,
count
(
$users
));
}
public
function
testIn
()
...
...
This diff is collapsed.
Click to expand it.
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