Get all customer contacts not imported for a website.

@param int $websiteId
@param int $pageSize

@return $this
4509
public function getContactsToImportForWebsite($websiteId, $pageSize = 100)
    {
        $collection = $this->addFieldToFilter('website_id', $websiteId)
            ->addFieldToFilter('email_imported', ['null' => true])
            ->addFieldToFilter('customer_id', ['neq' => '0']);

        $collection->getSelect()->limit($pageSize);

        return $collection;
    }
1224543
public function isOnlySubscribersForReview($websiteId)
    {
        $value = $this->scopeConfig->isSetFlag(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_ALLOW_NON_SUBSCRIBERS,
            \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
            $websiteId
        );
        return ($value) ? false : true;
    }
71382
protected function getSubPageIds($pageId)
    {
        /** @var $queryGenerator \TYPO3\CMS\Core\Database\QueryGenerator */
        $queryGenerator = GeneralUtility::makeInstance(QueryGenerator::class);

        // here we retrieve only the subpages of this page because the permission clause is not evaluated
        // on the root node.
        $permissionClause = ' 1 ' . BackendUtility::BEenableFields('pages');
        $treePageIdList = $queryGenerator->getTreeList($pageId, 20, 0, $permissionClause);
        $treePageIds = array_map('intval', explode(',', $treePageIdList));

            // the first one can be ignored because this is the page itself
        array_shift($treePageIds);

        return $treePageIds;
    }
14640
public function isGuestSyncEnabled($websiteId = 0)
    {
        return $this->scopeConfig->isSetFlag(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_GUEST_ENABLED,
            \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
            $websiteId
        );
    }
462852
public function paginate($page = 1, $pageSize = 10)
    {
        return $this
            ->limit($pageSize)
            ->offset($page > 1 ? $pageSize * ($page - 1) : 0);
    }
1306500
public function get(
        $page = 1,
        $pageSize = 1000,
        $subscribed = null,
        $onlyGuest = false,
        $websiteId = null,
        $storeId = null
    ) {

        $this
            ->initCollection()
            ->joinWebsite()
            ->filterWebsite($websiteId)
            ->filterStore($storeId)
            ->filterSubscribed($subscribed)
            ->filterCustomers($onlyGuest)
            ->setPage($page, $pageSize);

        return $this->subscriptionsResponseFactory->create()
            ->setCurrentPage($this->subscriptionCollection->getCurPage())
            ->setLastPage($this->subscriptionCollection->getLastPageNumber())
            ->setPageSize($this->subscriptionCollection->getPageSize())
            ->setTotalCount($this->subscriptionCollection->getSize())
            ->setSubscriptions($this->handleSubscriptions());
    }
176996
public function paginate($page, $pageSize)
    {
        $start = $page * $pageSize;
        return $this->limit($pageSize, $start);
    }
1252004
public function findByPageIdAndByLanguageId($pageId, $languageId)
    {
        try {
            $this->initializeSearch($pageId, $languageId);
            $pageQuery = $this->queryBuilder->buildPageQuery($pageId);
            $response = $this->search->search($pageQuery, 0, 10000);
        } catch (NoSolrConnectionFoundException $exception) {
            return [];
        } catch (SolrCommunicationException $exception) {
            return [];
        }
        $data = $response->getParsedData();
        return $this->documentEscapeService->applyHtmlSpecialCharsOnAllFields($data->response->docs ?? []);
    }
1346901
public function _processContactImportReportFaults($id, $websiteId)
    {
        $client = $this->helper->getWebsiteApiClient($websiteId);
        $report = $client->getContactImportReportFaults($id);

        if ($report) {
            $reportData = explode(PHP_EOL, $this->_removeUtf8Bom($report));
            //unset header
            unset($reportData[0]);
            //no data in report
            if (! empty($reportData)) {
                $contacts = [];
                foreach ($reportData as $row) {
                    $row = explode(',', $row);
                    //reason
                    if (in_array($row[0], $this->reasons)) {
                        //email
                        $contacts[] = $row[1];
                    }
                }

                //unsubscribe from email contact and newsletter subscriber tables
                $this->helper->contactResource->unsubscribe($contacts);
            }
        }
    }
635797
public function getData($pageSize, $page)
    {
        $criteria = clone($this->sqlment);
        /* @var Criteria $criteria */
        $criteria->setLimit(($page - 1) * $pageSize);
        $criteria->setOffset($pageSize);
        return $this->db->findAll($criteria);
    }
1256464
public function page($pageSize = 10, $currentPage = 0)
    {
        if ($pageSize === static::$pageAll) {
            return $this;
        }
        /* normalize $currentPage and $currentPage */
        if (!is_numeric($currentPage) || $currentPage < 0) {
            $currentPage = 0;
        }
        $currentPage = (int) $currentPage;
        if (!is_numeric($pageSize) || $pageSize < 1) {
            $pageSize = static::$defaultPageSize;
        }
        $pageSize = (int) $pageSize;
        return $this->limit($pageSize)->offset($pageSize * $currentPage);
    }
752596
public function getCustomerId($email, $websiteId)
    {
        // lazy loading
        $this->load();

        if (isset($this->_customerIds[$email][$websiteId])) {
            return $this->_customerIds[$email][$websiteId];
        }

        return false;
    }
595542
public function setPageSizes(array $pageSizes)
    {
        $this->pageSizes = $pageSizes;

        // Reset items per page
        $this->setItemsPerPage(current($pageSizes));

        return $this;
    }
22587
public function query_db($pagesize, $useinitialsbar = true) {

        $joins = array();
        $params = array();

        // Set up filtering.
        if (!empty($this->filterparams->courseid)) {
            $joins[] = "courseid = :courseid";
            $params['courseid'] = $this->filterparams->courseid;
        }

        if (!empty($this->filterparams->date)) {
            $joins[] = "timecreated > :date";
            $params['date'] = $this->filterparams->date;
        }

        if (isset($this->filterparams->anonymous)) {
            $joins[] = "anonymous = :anon";
            $params['anon'] = $this->filterparams->anonymous;
        }

        $selector = implode(' AND ', $joins);

        $total = $this->filterparams->logreader->get_events_select_count($selector, $params);
        $this->pagesize($pagesize, $total);
        $this->rawdata = $this->filterparams->logreader->get_events_select($selector, $params, $this->filterparams->orderby,
                $this->get_page_start(), $this->get_page_size());

        // Set initial bars.
        if ($useinitialsbar) {
            $this->initialbars($total > $pagesize);
        }

        // Update list of users and courses list which will be displayed on log page.
        $this->update_users_and_courses_used();
    }
111838
public function filterItemsForReview($items, $websiteId)
    {
        $order = $this->getOrder();

        if (empty($items) || ! $order) {
            return false;
        }

        //if customer is guest then no need to filter any items
        if ($order->getCustomerIsGuest()) {
            return $items;
        }

        if (!$this->helper->isNewProductOnly($websiteId)) {
            return $items;
        }

        $customerId = $order->getCustomerId();

        $items = $this->review->filterItemsForReview($items, $customerId, $order);

        return $items;
    }
456087
public function getProductPageCount(int $pageSize = 100) : int
    {
        Assert::that($pageSize)->greaterThan(0, 'The $pageSize has to be positive');

        return (int)$this->master->doRequest(
            'GET',
            sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductDataService/{KEY}/ProductPageCount/%d', $pageSize)
        );
    }
181357
public function setConnectorContactToReImport($customerId)
    {
        $contactModel = $this->contactFactory->create();
        $contactModel->loadByCustomerId($customerId)
            ->setEmailImported(
                \Dotdigitalgroup\Email\Model\Contact::EMAIL_CONTACT_NOT_IMPORTED
            );
        $this->contactResource->save($contactModel);
    }