-
Notifications
You must be signed in to change notification settings - Fork 82
Fix search criteria reference #2927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
37b32d5
d20483a
7a31ea2
860a306
ef3c3e9
8e39860
91af31a
b7f39b5
617fe41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,4 @@ $query->query = new Criterion\ContentName('*phone'); | |
"ContentNameCriterion": "*phone" | ||
} | ||
} | ||
``` | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,4 +118,4 @@ $query->query = new Criterion\Image('image', $imageCriteriaData); | |
} | ||
} | ||
} | ||
``` | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,4 +70,4 @@ $query->query = new Criterion\Dimensions('image', $imageCriteriaData); | |
} | ||
} | ||
} | ||
``` | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,4 +52,4 @@ $query->query = new Criterion\FileSize('image', 0, 1.5); | |
} | ||
} | ||
} | ||
``` | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,4 +67,4 @@ $query->query = new Criterion\MimeType('image', $mimeTypes); | |
} | ||
} | ||
} | ||
``` | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,4 +66,4 @@ $query->query = new Criterion\Orientation('image', $orientations); | |
} | ||
} | ||
} | ||
``` | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
Check warning on line 1 in docs/search/criteria_reference/iscontainer_criterion.md
|
||
description: IsContainer Search Criterion | ||
--- | ||
|
||
# IsContainer Criterion | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice 😄 Could you please add it to the table with criterions (https://github.com/ibexa/documentation-developer/blob/5.0/docs/search/criteria_reference/search_criteria_reference.md) ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
The [`IsContainer` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-IsContainer.html) searches for content items based on whether they are containers (i.e., can contain other content items). | ||
Check failure on line 7 in docs/search/criteria_reference/iscontainer_criterion.md
|
||
|
||
## Arguments | ||
|
||
- `value` – boolean (optional, default: `true`). If `true`, searches for content that is a container. If `false`, searches for content that is not a container. | ||
Check failure on line 11 in docs/search/criteria_reference/iscontainer_criterion.md
|
||
|
||
## Example | ||
|
||
### PHP | ||
|
||
```php | ||
$query->query = new Criterion\IsContainer(); // Finds containers | ||
$query->query = new Criterion\IsContainer(false); // Finds non-containers | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,3 @@ $productQuery = new ProductQuery( | |
new Criterion\ProductStock(50, '>=') | ||
); | ||
``` | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,3 @@ $productQuery = new ProductQuery( | |
new Criterion\ProductStockRange(10, 120) | ||
); | ||
``` | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't comment on line 38, asking to be sure - arrays work for JSON requests, but do not work for XML?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/ibexa/rest/blob/v5.0.2/src/lib/Server/Input/Parser/Criterion/ContentTypeGroupId.php#L31 is creating the criterion with raw data, the criterion constructor expect integer or array.
And, yes:
In JSON, arrays exist; In XML they doesn't exist.
So, the following JSON works:
While the following XML fails:
The error is "ContentTypeGroupId::__construct(): Argument #1 ($value) must be of type array|int, string given".
The following works because the node value is seen as an integer somewhen betwen XML parsing and PHP type juggling:
But there is no way to write an anonymous array in XML, you need a named tag node. That's why the
ContentIdCriterion
transform the data before passing it (actually splitting string into array using coma as separator).