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

Criterion a a part of Query object is not handled as optional

    Details

      Description

      Though it is not marked as required, Criterion a a part of Query object not being handled as optional, which makes some things awkward and inefficient.
      For example to fetch a list of 10 last published Content now we have to use something like:

      new Query(
          array(
              'criterion'   => new Criterion\LogicalNot( new Criterion\ContentId( array( 0 ) ) ),
              'offset'      => 0,
              'limit'       => 10,
              'sortClauses' => array(
                  new SortClause\DatePublished(),
              )
          )
      )
      

      While it would be more efficient and natural to just have:

      new Query(
          array(
              'criterion'   => null,// or omit this line altogether
              'offset'      => 0,
              'limit'       => 10,
              'sortClauses' => array(
                  new SortClause\DatePublished(),
              )
          )
      )
      

      Both Legacy and Solr storage gateways need to be updated to handle this change.

      We should also document in API Query class that $criterion property is optional and what it means if it is not provided.
      Also, SPI SearchHandler::findContent() should document for implementers that null as criterion needs to be handled.

        Activity

        Petar Spanja (Inactive) created issue -
        Petar Spanja (Inactive) made changes -
        Field Original Value New Value
        Summary Criterion a a part of Query object is not optional Criterion a a part of Query object is not handled as optional
        Petar Spanja (Inactive) made changes -
        Description Criterion a a part of Query object not being optional makes some things awkward and inefficient.
        For example to fetch a list of 10 last published Content now we have to use something like:

        {code}
        new Query(
            array(
                'criterion' => new Criterion\LogicalNot( new Criterion\ContentId( array( 0 ) ) ),
                'offset' => 0,
                'limit' => 10,
                'sortClauses' => array(
                    new SortClause\DatePublished(),
                )
            )
        )
        {code}

        While it would be more efficient and natural to just have:

        {code}
        new Query(
            array(
                'criterion' => null,// or omit this line altogether
                'offset' => 0,
                'limit' => 10,
                'sortClauses' => array(
                    new SortClause\DatePublished(),
                )
            )
        )
        {code}

        Both Legacy and Solr storage gateways need to be updated to handle this change.

        We should also document in API Query class that $criterion property is optional and what it means if it is not provided.
        Also, SPI SearchHandler::findContent() should document for implementers that null as criterion needs to be handled.
        Though it is not marked as required, Criterion a a part of Query object not being handled as optional, which makes some things awkward and inefficient.
        For example to fetch a list of 10 last published Content now we have to use something like:

        {code}
        new Query(
            array(
                'criterion' => new Criterion\LogicalNot( new Criterion\ContentId( array( 0 ) ) ),
                'offset' => 0,
                'limit' => 10,
                'sortClauses' => array(
                    new SortClause\DatePublished(),
                )
            )
        )
        {code}

        While it would be more efficient and natural to just have:

        {code}
        new Query(
            array(
                'criterion' => null,// or omit this line altogether
                'offset' => 0,
                'limit' => 10,
                'sortClauses' => array(
                    new SortClause\DatePublished(),
                )
            )
        )
        {code}

        Both Legacy and Solr storage gateways need to be updated to handle this change.

        We should also document in API Query class that $criterion property is optional and what it means if it is not provided.
        Also, SPI SearchHandler::findContent() should document for implementers that null as criterion needs to be handled.
        André Rømcke made changes -
        Workflow eZ Engineering Scrumban Workflow [ 59092 ] EZ* Development Workflow [ 69232 ]
        Alex Schuster made changes -
        Workflow EZ* Development Workflow [ 69232 ] EZEE Development Workflow [ 107346 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Petar Spanja (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: