Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2681436
D25554.1734641779.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25554.1734641779.diff
View Options
diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php
--- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php
@@ -48,15 +48,28 @@
return $request->getStr($this->getFieldKey());
}
+ /**
+ * Apply an application search constraint to a query.
+ * If you have a field of type integer, and a value (or an array of values),
+ * the result set will be limited to the rows with these values.
+ * @param PhabricatorApplicationSearchEngine $engine
+ * @param PhabricatorCursorPagedPolicyAwareQuery $query
+ * @param mixed $value Single value or array of values (IN query).
+ */
public function applyApplicationSearchConstraintToQuery(
PhabricatorApplicationSearchEngine $engine,
PhabricatorCursorPagedPolicyAwareQuery $query,
$value) {
- if (phutil_nonempty_scalar($value)) {
- $query->withApplicationSearchContainsConstraint(
- $this->newNumericIndex(null),
- $value);
+ // The basic use case is with a single value.
+ // The backend really works with an array. So also array allowed.
+ if (is_array($value) || phutil_nonempty_scalar($value)) {
+ $value = (array)$value;
+ if ($value) {
+ $query->withApplicationSearchContainsConstraint(
+ $this->newNumericIndex(null),
+ $value);
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 20:56 (20 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1015562
Default Alt Text
D25554.1734641779.diff (1 KB)
Attached To
Mode
D25554: Custom integer fields: fix search by array of possible values
Attached
Detach File
Event Timeline
Log In to Comment