Details
-
Improvement
-
Resolution: Duplicate
-
Medium
-
5.0
-
None
Description
Criterion objects, used by the Public API to search for content, are all different, and require to be documented as a reference.
What needs to be documented
- what value format the Criterion accepts
- what operators are supported
- what they can "target" (e.g. apply to)
Where the information can be found
Built-in criterion objects are declared in eZ/Publish/API/Repository/Values/Content/Query/Criterion.
Some of the criteria are documented in PHPDoc, like ContentId. Others are not...
Each Criterion constructor will support up to three parameters: target, operator and value. Some only support value, some only value & operator, and so on.
In this example: the criterion (Criterion\ContentId only accepts a value:
public function __construct( $value ) { parent::__construct( null, null, $value ); }
Parameters can also be polymorphic: ContentId only accepts value, but value can be an integer (in which case the operator is Criterion\Operator::EQ or an array of ContentId using the Criterion\Operator::IN operator. In this case, the operator is silently selected depending on the input type.
The Criterion::getSpecifications() method indicates which operators are supported by the Criterion, and which input value is expected: Criterion\Specifications::FORMAT_SINGLE or Criterion\Specifications::FORMAT_ARRAY. Some specification entries also specify a type of value, for both single and array formats: Specifications::TYPE_INTEGER.
Some Criteria support a target. One example is datetime, that can apply to either the creation date, or the modification date (and should actually also apply to Date / DateTime Fields...).
Attachments
Issue Links
- is duplicated by
-
EZP-22278 As a developer I need Criterion documentation
- Closed