eZ Platform Discussions

Sort by field on multiple content type



I need all the items back, A’s son.
Who is assigned main_menu greater than 0.
Sorted by main_menu descending

A can contain any kind of objects.
All these objects do not necessarily have the main_menu attribute. (It does not exist in their ContentType)
I don’t want to list ContentType that have this attribute.

        $query = new LocationQuery();
        $query->filter = new Query\Criterion\LogicalAnd([
            new Query\Criterion\ParentLocationId($location->id),
            new Query\Criterion\Field('main_menu', '>', 0),
        $query->sortClauses = [
            new Query\SortClause\Field(/* ? */ , 'main_menu', Query::SORT_ASC), // TODO
        $searchResut = $this->getRepository()->getSearchService()->findLocations($query);

The problem is that Query\SortClause\Field is waiting for a $typeIdentifier first parameter and I don’t have one…

In eZ4 we used to go through sorl to do that.
Something like:

sort_by, hash( 'attr_main_menu_i', desc))})

How can I do the same with eZPlatform 2.2?