1

In my component/ui/dataprovider I have the following.

class TheProvider extends DataProvider
{
    /**
     * Get collection data
     * @return array
     */
    public function getData()
    {
        $this->setFilter();
        return parent::getData();
    }

    /**
     * Adds filter to collection for view
     * @return void
     */
    protected function setFilter()
    {
        $this->addFilter(
        $this->filterBuilder
            ->setField('status')
            ->setValue('pending')
            ->setConditionType('eq')
            ->create()
        );
    }
}

So obviously 'setFilter()' applies the following conditions to the data source...

WHERE status='pending'

What I want to do is apply the following logic in the filter.

WHERE (status = 'pending' AND store_id = 1) OR (status='processing' AND store_id = 2)

It seems I can easily create chained AND conditions, but I can't find anything in the code that allows me to chain OR conditions.

Is this possible without having to modify the model's collection query?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.