Details
-
Bug
-
Resolution: Fixed
-
High
-
5.2, 5.3-dev
Description
When filtering on an attribute of type Object Relation the results are not as expected.
(as in
new Criterion\Field( 'recipient', Criterion\Operator::EQ, $currentUserId )
where 'recipient' is an attribute of datatype 'Object Relation')
This seems to be due to the fact that the searchService only takes into consideration the database fields sort_key_int or sort_key_string (depending onthe datatype).
But in the converter class for Relation the sortKey is hardcoded to "false" which leads to empty entries in the sort_key_int column of ezcontentobject_attribute table rows for Object Relations.
My quick fix was to replace
public function toFieldValue( StorageFieldValue $value, FieldValue $fieldValue ) { $fieldValue->data = array( "destinationContentId" => $value->dataInt, ); $fieldValue->sortKey = false; }
with
public function toFieldValue( StorageFieldValue $value, FieldValue $fieldValue ) { $fieldValue->data = array( "destinationContentId" => $value->dataInt, ); $storageFieldValue->sortKeyInt = (int)$value->sortKey; }
which seems to fix the problem. Since i'm no kernel-expert on eZ5 i'm not sure if this is the best solution, though.
Attachments
Issue Links
- testing discovered
-
EZP-22885 Unable use Query\Criterion to fetch ezobjectrelationlist field
- Confirmed