Skip to content

Commit

Permalink
Merge pull request #1 from krasun/master
Browse files Browse the repository at this point in the history
Add in and not in comparison operators
  • Loading branch information
f1nder committed Apr 9, 2014
2 parents 254dea8 + b07fdd4 commit aca3cdf
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Solution/MongoAggregation/Pipeline/Operators/Comparison/In.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Solution\MongoAggregation\Pipeline\Operators\Comparison;

use Solution\MongoAggregation\Pipeline\Operators\Operator;

class In extends Operator
{
function getName()
{
return 'in';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Solution\MongoAggregation\Pipeline\Operators\Comparison;

use Solution\MongoAggregation\Pipeline\Operators\Operator;

class Nin extends Operator
{
function getName()
{
return 'nin';
}
}
17 changes: 17 additions & 0 deletions src/Solution/MongoAggregation/Pipeline/Operators/Expr.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,23 @@ public function ne($arg)
return new Operators\Comparison\Ne($arg);
}

/**
* @param $arg
* @return Comparison\In
*/
public function in($arg)
{
return new Operators\Comparison\In($arg);
}

/**
* @param $arg
* @return Comparison\Nin
*/
public function nin($arg)
{
return new Operators\Comparison\Nin($arg);
}

/**
* @param $arg
Expand Down
2 changes: 2 additions & 0 deletions tests/Tests/Operators/OperatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ static public function operators()
['lt', 'lt'],
['lte', 'lte'],
['ne', 'ne'],
['in', 'in'],
['nin', 'nin'],
//conditional
['cond', 'cond'],
['ifNull', 'ifNull'],
Expand Down

0 comments on commit aca3cdf

Please sign in to comment.