Install zendframework via composer, update build.xml and run, updates to composer
[openemr.git] / vendor / doctrine / collections / lib / Doctrine / Common / Collections / ExpressionBuilder.php
blob6539e3c75fd44f27b38e81e6bec5f5f7a76e92ab
1 <?php
2 /*
3 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 * This software consists of voluntary contributions made by many individuals
16 * and is licensed under the MIT license. For more information, see
17 * <http://www.doctrine-project.org>.
20 namespace Doctrine\Common\Collections;
22 use Doctrine\Common\Collections\Expr\Comparison;
23 use Doctrine\Common\Collections\Expr\CompositeExpression;
24 use Doctrine\Common\Collections\Expr\Value;
26 /**
27 * Builder for Expressions in the {@link Selectable} interface.
29 * Important Notice for interoperable code: You have to use scalar
30 * values only for comparisons, otherwise the behavior of the comparision
31 * may be different between implementations (Array vs ORM vs ODM).
33 * @author Benjamin Eberlei <kontakt@beberlei.de>
34 * @since 2.3
36 class ExpressionBuilder
38 /**
39 * @param mixed $x
41 * @return CompositeExpression
43 public function andX($x = null)
45 return new CompositeExpression(CompositeExpression::TYPE_AND, func_get_args());
48 /**
49 * @param mixed $x
51 * @return CompositeExpression
53 public function orX($x = null)
55 return new CompositeExpression(CompositeExpression::TYPE_OR, func_get_args());
58 /**
59 * @param string $field
60 * @param mixed $value
62 * @return Comparison
64 public function eq($field, $value)
66 return new Comparison($field, Comparison::EQ, new Value($value));
69 /**
70 * @param string $field
71 * @param mixed $value
73 * @return Comparison
75 public function gt($field, $value)
77 return new Comparison($field, Comparison::GT, new Value($value));
80 /**
81 * @param string $field
82 * @param mixed $value
84 * @return Comparison
86 public function lt($field, $value)
88 return new Comparison($field, Comparison::LT, new Value($value));
91 /**
92 * @param string $field
93 * @param mixed $value
95 * @return Comparison
97 public function gte($field, $value)
99 return new Comparison($field, Comparison::GTE, new Value($value));
103 * @param string $field
104 * @param mixed $value
106 * @return Comparison
108 public function lte($field, $value)
110 return new Comparison($field, Comparison::LTE, new Value($value));
114 * @param string $field
115 * @param mixed $value
117 * @return Comparison
119 public function neq($field, $value)
121 return new Comparison($field, Comparison::NEQ, new Value($value));
125 * @param string $field
127 * @return Comparison
129 public function isNull($field)
131 return new Comparison($field, Comparison::EQ, new Value(null));
135 * @param string $field
136 * @param mixed $values
138 * @return Comparison
140 public function in($field, array $values)
142 return new Comparison($field, Comparison::IN, new Value($values));
146 * @param string $field
147 * @param mixed $values
149 * @return Comparison
151 public function notIn($field, array $values)
153 return new Comparison($field, Comparison::NIN, new Value($values));
157 * @param string $field
158 * @param mixed $value
160 * @return Comparison
162 public function contains($field, $value)
164 return new Comparison($field, Comparison::CONTAINS, new Value($value));