Model/ResourceModel/Campaign/Collection.php
public function getExpiredEmailCampaignsByStoreIds($storeIds)
    {
        $time = new \DateTime('now', new \DateTimezone('UTC'));
        $interval = $this->dateIntervalFactory->create(
            ['interval_spec' => sprintf('PT%sH', 2)]
        );
        $time->sub($interval);

        $campaignCollection = $this->addFieldToFilter('campaign_id', ['notnull' => true])
            ->addFieldToFilter('send_status', \Dotdigitalgroup\Email\Model\Campaign::PROCESSING)
            ->addFieldToFilter('store_id', ['in' => $storeIds])
            ->addFieldToFilter('send_id', ['notnull' => true])
            ->addFieldToFilter('updated_at', ['lt' => $time->format('Y-m-d H:i:s')]);

        return $campaignCollection;
    }
public function getExpiredEmailCampaignsByStoreIds($storeIds)
    {
        $time = new \DateTime('now', new \DateTimezone('UTC'));
        $interval = $this->dateIntervalFactory->create(
            ['interval_spec' => sprintf('PT%sH', 2)]
        );
        $time->sub($interval);

        $campaignCollection = $this->addFieldToFilter('campaign_id', ['notnull' => true])
            ->addFieldToFilter('send_status', \Dotdigitalgroup\Email\Model\Campaign::PROCESSING)
            ->addFieldToFilter('store_id', ['in' => $storeIds])
            ->addFieldToFilter('send_id', ['notnull' => true])
            ->addFieldToFilter('updated_at', ['lt' => $time->format('Y-m-d H:i:s')]);

        return $campaignCollection;
    }
public function getExpiredEmailCampaignsByStoreIds ( $ storeIds ) { $ time = new \ DateTime ( 'now' , new \ DateTimezone ( 'UTC' ) ) ; $ interval = $ this -> dateIntervalFactory -> create ( [ 'interval_spec' => sprintf ( 'PT%sH' , 2 ) ] ) ; $ time -> sub ( $ interval ) ; $ campaignCollection = $ this -> addFieldToFilter ( 'campaign_id' , [ 'notnull' => true ] ) -> addFieldToFilter ( 'send_status' , \ Dotdigitalgroup \ Email \ Model \ Campaign :: PROCESSING ) -> addFieldToFilter ( 'store_id' , [ 'in' => $ storeIds ] ) -> addFieldToFilter ( 'send_id' , [ 'notnull' => true ] ) -> addFieldToFilter ( 'updated_at' , [ 'lt' => $ time -> format ( 'Y-m-d H:i:s' ) ] ) ; return $ campaignCollection ; }
Get expired campaigns by store ids

@param array $storeIds
@return Collection
Get expired campaigns by store ids