Model/ResourceModel/Contact/Collection.php
public function getContactsToImportByWebsite($websiteId, $syncLimit, $onlySubscriber = false)
    {
        $collection = $this->addFieldToSelect('*')
            ->addFieldToFilter('customer_id', ['neq' => '0'])
            ->addFieldToFilter('email_imported', ['null' => true])
            ->addFieldToFilter('website_id', $websiteId)
            ->setPageSize($syncLimit);

        if ($onlySubscriber) {
            $collection->addFieldToFilter('is_subscriber', 1)
                ->addFieldToFilter(
                    'subscriber_status',
                    \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED
                );
        }

        return $collection;
    }
public function getContactsToImportByWebsite($websiteId, $syncLimit, $onlySubscriber = false)
    {
        $collection = $this->addFieldToSelect('*')
            ->addFieldToFilter('customer_id', ['neq' => '0'])
            ->addFieldToFilter('email_imported', ['null' => true])
            ->addFieldToFilter('website_id', $websiteId)
            ->setPageSize($syncLimit);

        if ($onlySubscriber) {
            $collection->addFieldToFilter('is_subscriber', 1)
                ->addFieldToFilter(
                    'subscriber_status',
                    \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED
                );
        }

        return $collection;
    }
public function getContactsToImportByWebsite ( $ websiteId , $ syncLimit , $ onlySubscriber = false ) { $ collection = $ this -> addFieldToSelect ( '*' ) -> addFieldToFilter ( 'customer_id' , [ 'neq' => '0' ] ) -> addFieldToFilter ( 'email_imported' , [ 'null' => true ] ) -> addFieldToFilter ( 'website_id' , $ websiteId ) -> setPageSize ( $ syncLimit ) ; if ( $ onlySubscriber ) { $ collection -> addFieldToFilter ( 'is_subscriber' , 1 ) -> addFieldToFilter ( 'subscriber_status' , \ Magento \ Newsletter \ Model \ Subscriber :: STATUS_SUBSCRIBED ) ; } return $ collection ; }
Get contacts to import by website

@param int $websiteId
@param int $syncLimit
@param boolean $onlySubscriber
@return $this
Get contacts to import by website