/** * @return $this */ public function addPlaceOrderFilter() { $this->addFieldToFilter('status', array('in' => Adyen_Subscription_Model_Subscription::getPlaceOrderStatuses())); $this->getSelect()->joinLeft(['subscription_quote' => $this->getTable('adyen_subscription/subscription_quote')], 'main_table.entity_id = subscription_quote.subscription_id', ['quote_id', 'order_id']); $this->getSelect()->where("scheduled_at < ?", now())->where('subscription_quote.order_id IS NULL')->where('subscription_quote.quote_id IS NOT NULL'); return $this; }