Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23393

Passing null as language for sorting field throws an Exception

    XMLWordPrintable

Details

    Description

      According to phpdoc for https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Publish/API/Repository/Values/Content/Query/SortClause/Field.php#L30, you can pass null as the language param when using and SortClause\Field.

      In other words, theorically you could do something like

       $query->sortClauses = array( new Query\SortClause\Field( 'content_type_identifier', 'field_identifier') );
      

      but doing like that throws an exception

      Argument '$query->sortClauses[0]' is invalid: No language is specified for translatable field
      

      This is because searchService throws a exception when null is passed
      https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Publish/Core/Repository/SearchService.php#L222

      To me, null should be allowed and then take main language as default for doing the sort. Otherwise, phpdoc of that method needs to be update.

      Attachments

        Activity

          People

            Unassigned Unassigned
            desorden desorden
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: