diff options
Diffstat (limited to 'vendor/doctrine/collections/docs/en/expressions.rst')
-rw-r--r-- | vendor/doctrine/collections/docs/en/expressions.rst | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/vendor/doctrine/collections/docs/en/expressions.rst b/vendor/doctrine/collections/docs/en/expressions.rst new file mode 100644 index 0000000..5587bfb --- /dev/null +++ b/vendor/doctrine/collections/docs/en/expressions.rst | |||
@@ -0,0 +1,117 @@ | |||
1 | Expressions | ||
2 | =========== | ||
3 | |||
4 | The ``Doctrine\Common\Collections\Expr\Comparison`` class | ||
5 | can be used to create comparison expressions to be used with the | ||
6 | ``Doctrine\Common\Collections\Criteria`` class. It has the | ||
7 | following operator constants: | ||
8 | |||
9 | - ``Comparison::EQ`` | ||
10 | - ``Comparison::NEQ`` | ||
11 | - ``Comparison::LT`` | ||
12 | - ``Comparison::LTE`` | ||
13 | - ``Comparison::GT`` | ||
14 | - ``Comparison::GTE`` | ||
15 | - ``Comparison::IS`` | ||
16 | - ``Comparison::IN`` | ||
17 | - ``Comparison::NIN`` | ||
18 | - ``Comparison::CONTAINS`` | ||
19 | - ``Comparison::MEMBER_OF`` | ||
20 | - ``Comparison::STARTS_WITH`` | ||
21 | - ``Comparison::ENDS_WITH`` | ||
22 | |||
23 | The ``Doctrine\Common\Collections\Expr\CompositeExpression`` class | ||
24 | can be used to create composite expressions to be used with the | ||
25 | ``Doctrine\Common\Collections\Criteria`` class. It has the | ||
26 | following operator constants: | ||
27 | |||
28 | - ``CompositeExpression::TYPE_AND`` | ||
29 | - ``CompositeExpression::TYPE_OR`` | ||
30 | - ``CompositeExpression::TYPE_NOT`` | ||
31 | |||
32 | When using the ``TYPE_OR`` and ``TYPE_AND`` operators the | ||
33 | ``CompositeExpression`` accepts multiple expressions as parameter | ||
34 | but only one expression can be provided when using the ``NOT`` operator. | ||
35 | |||
36 | The ``Doctrine\Common\Collections\Criteria`` class has the following | ||
37 | API to be used with expressions: | ||
38 | |||
39 | where | ||
40 | ----- | ||
41 | |||
42 | Sets the where expression to evaluate when this Criteria is searched for. | ||
43 | |||
44 | .. code-block:: php | ||
45 | $expr = new Comparison('key', Comparison::EQ, 'value'); | ||
46 | |||
47 | $criteria->where($expr); | ||
48 | |||
49 | andWhere | ||
50 | -------- | ||
51 | |||
52 | Appends the where expression to evaluate when this Criteria is searched for | ||
53 | using an AND with previous expression. | ||
54 | |||
55 | .. code-block:: php | ||
56 | $expr = new Comparison('key', Comparison::EQ, 'value'); | ||
57 | |||
58 | $criteria->andWhere($expr); | ||
59 | |||
60 | orWhere | ||
61 | ------- | ||
62 | |||
63 | Appends the where expression to evaluate when this Criteria is searched for | ||
64 | using an OR with previous expression. | ||
65 | |||
66 | .. code-block:: php | ||
67 | $expr1 = new Comparison('key', Comparison::EQ, 'value1'); | ||
68 | $expr2 = new Comparison('key', Comparison::EQ, 'value2'); | ||
69 | |||
70 | $criteria->where($expr1); | ||
71 | $criteria->orWhere($expr2); | ||
72 | |||
73 | orderBy | ||
74 | ------- | ||
75 | |||
76 | Sets the ordering of the result of this Criteria. | ||
77 | |||
78 | .. code-block:: php | ||
79 | use Doctrine\Common\Collections\Order; | ||
80 | |||
81 | $criteria->orderBy(['name' => Order::Ascending]); | ||
82 | |||
83 | setFirstResult | ||
84 | -------------- | ||
85 | |||
86 | Set the number of first result that this Criteria should return. | ||
87 | |||
88 | .. code-block:: php | ||
89 | $criteria->setFirstResult(0); | ||
90 | |||
91 | getFirstResult | ||
92 | -------------- | ||
93 | |||
94 | Gets the current first result option of this Criteria. | ||
95 | |||
96 | .. code-block:: php | ||
97 | $criteria->setFirstResult(10); | ||
98 | |||
99 | echo $criteria->getFirstResult(); // 10 | ||
100 | |||
101 | setMaxResults | ||
102 | ------------- | ||
103 | |||
104 | Sets the max results that this Criteria should return. | ||
105 | |||
106 | .. code-block:: php | ||
107 | $criteria->setMaxResults(20); | ||
108 | |||
109 | getMaxResults | ||
110 | ------------- | ||
111 | |||
112 | Gets the current max results option of this Criteria. | ||
113 | |||
114 | .. code-block:: php | ||
115 | $criteria->setMaxResults(20); | ||
116 | |||
117 | echo $criteria->getMaxResults(); // 20 | ||