Skip to content

Commit 7b1fa4b

Browse files
committed
#19 - Accept arrays of restrictions in or() and and()
1 parent 2852ae9 commit 7b1fa4b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/TgDatabase/Restrictions.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,19 @@ public static function notIn($propertyName, $values) {
121121
* Apply an "and" conjunction.
122122
*/
123123
public static function and(...$expressions) {
124+
if ((count($expressions) == 1) && is_array($expressions[0])) {
125+
return new LogicalExpression('AND', $expressions[0]);
126+
}
124127
return new LogicalExpression('AND', $expressions);
125128
}
126129

127130
/**
128131
* Apply an "or" conjunction.
129132
*/
130133
public static function or(...$expressions) {
134+
if ((count($expressions) == 1) && is_array($expressions[0])) {
135+
return new LogicalExpression('OR', $expressions[0]);
136+
}
131137
return new LogicalExpression('OR', $expressions);
132138
}
133139

0 commit comments

Comments
 (0)