1

I want to search for Entries of the same channel/section based on their type. Let's say, we are a travel company with two types of tours: "guided group" and "private". For group tours, we want trips associated with a particular provider. For private tours, we want trips less than a certain price (this field is N/A for group journeys).

In the controller:

$criteriaFilters = [
    'section'=>'journeys',
    'relatedTo'=> [<ids of the provider>],// Should be for group only
    'price'=>'<10', // Should be for private tour only
];
$criteria = craft()->elements->getCriteria(
    ElementType::Entry,
    $criteriaFilters
);

I need to retrieve them all in an ElementCriteriaModel object, via one SQL query. I don't want to get all private and guided tours separately and then combine them because that doesn't work well with pagination.

What do you think is best to achieve this? (in PHP, not Twig)

1 Answers1

1

I don't think it's possible to do what you're trying to do in a single ElementCriteriaModel query.

These questions are basically asking the same thing and can confirm it.

Brad Bell
  • 67,440
  • 6
  • 73
  • 143