|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the SmartGecko(c) business platform. |
|
4
|
|
|
* |
|
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
6
|
|
|
* file that was distributed with this source code. |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Governor\Framework\EventStore\Mongo\Criteria; |
|
10
|
|
|
|
|
11
|
|
|
use Governor\Framework\EventStore\Management\PropertyInterface; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Property implementation for use by the Mongo Event Store. |
|
16
|
|
|
* |
|
17
|
|
|
* @author "David Kalosi" <[email protected]> |
|
18
|
|
|
* @license <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> |
|
19
|
|
|
*/ |
|
20
|
|
|
class MongoProperty implements PropertyInterface |
|
21
|
|
|
{ |
|
22
|
|
|
|
|
23
|
|
|
private $propertyName; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Initialize a property for the given <code>propertyName</code>. |
|
27
|
|
|
* |
|
28
|
|
|
* @param string $propertyName The name of the property of the Mongo document. |
|
29
|
|
|
*/ |
|
30
|
6 |
|
public function __construct($propertyName) |
|
31
|
|
|
{ |
|
32
|
6 |
|
$this->propertyName = $propertyName; |
|
33
|
6 |
|
} |
|
34
|
|
|
|
|
35
|
|
|
|
|
36
|
|
|
public function lessThan($expression) |
|
37
|
|
|
{ |
|
38
|
|
|
return new SimpleMongoOperator($this, '$lt', $expression); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
|
|
42
|
|
|
public function lessThanEquals($expression) |
|
43
|
|
|
{ |
|
44
|
|
|
return new SimpleMongoOperator($this, '$lte', $expression); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
public function greaterThan($expression) |
|
49
|
|
|
{ |
|
50
|
|
|
return new SimpleMongoOperator($this, '$gt', $expression); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
|
|
54
|
|
|
public function greaterThanEquals($expression) |
|
55
|
|
|
{ |
|
56
|
|
|
return new SimpleMongoOperator($this, '$gte', $expression); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
public function is($expression) |
|
61
|
|
|
{ |
|
62
|
|
|
return new Equals($this, $expression); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
|
|
66
|
|
|
public function isNot($expression) |
|
67
|
|
|
{ |
|
68
|
|
|
return new SimpleMongoOperator($this, '$ne', $expression); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
|
|
72
|
2 |
|
public function in($expression) |
|
73
|
|
|
{ |
|
74
|
2 |
|
return new CollectionCriteria($this, '$in', $expression); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
|
|
78
|
1 |
|
public function notIn($expression) |
|
79
|
|
|
{ |
|
80
|
1 |
|
return new CollectionCriteria($this, '$nin', $expression); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Returns the name of the property. |
|
85
|
|
|
* |
|
86
|
|
|
* @return string the name of the property |
|
87
|
|
|
*/ |
|
88
|
5 |
|
public function getName() |
|
89
|
|
|
{ |
|
90
|
5 |
|
return $this->propertyName; |
|
91
|
|
|
} |
|
92
|
|
|
} |