Skip to content

Commit

Permalink
fix: remove extra file
Browse files Browse the repository at this point in the history
  • Loading branch information
fox-john committed Sep 20, 2024
1 parent 3ece03f commit 8fb1d47
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions OLD/Provider/CustomerDataProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php

namespace PrestaShop\Module\PsEventbus\Provider;

use PrestaShop\Module\PsEventbus\Config\Config;
use PrestaShop\Module\PsEventbus\Decorator\CustomerDecorator;
use PrestaShop\Module\PsEventbus\Repository\CustomerRepository;

class CustomerDataProvider implements PaginatedApiDataProviderInterface
{
/**
* @var CustomerRepository
*/
private $customerRepository;
/**
* @var CustomerDecorator
*/
private $customerDecorator;

public function __construct(CustomerRepository $customerRepository, CustomerDecorator $customerDecorator)
{
$this->customerRepository = $customerRepository;
$this->customerDecorator = $customerDecorator;
}

/**
* @param int $offset
* @param int $limit
* @param string $langIso
*
* @return array<mixed>
*
* @@throws \PrestaShopDatabaseException
*/
public function getFormattedData($offset, $limit, $langIso)
{
$customers = $this->customerRepository->getCustomers($offset, $limit);

if (!is_array($customers)) {
return [];
}

$this->customerDecorator->decorateCustomers($customers);

return array_map(function ($customer) {
return [
'id' => "{$customer['id_customer']}",
'collection' => Config::COLLECTION_CUSTOMERS,
'properties' => $customer,
];
}, $customers);
}

/**
* @param int $offset
* @param string $langIso
*
* @return int
*/
public function getRemainingObjectsCount($offset, $langIso)
{
return (int) $this->customerRepository->getRemainingCustomersCount($offset);
}

/**
* @param int $limit
* @param string $langIso
* @param array<mixed> $objectIds
*
* @return array<mixed>
*
* @@throws \PrestaShopDatabaseException
*/
public function getFormattedDataIncremental($limit, $langIso, $objectIds)
{
$customers = $this->customerRepository->getCustomersIncremental($limit, $objectIds);

if (!is_array($customers)) {
return [];
}

$this->customerDecorator->decorateCustomers($customers);

return array_map(function ($customer) {
return [
'id' => "{$customer['id_customer']}",
'collection' => Config::COLLECTION_CUSTOMERS,
'properties' => $customer,
];
}, $customers);
}

/**
* @param int $offset
* @param int $limit
* @param string $langIso
*
* @return array<mixed>
*
* @@throws \PrestaShopDatabaseException
*/
public function getQueryForDebug($offset, $limit, $langIso)
{
return $this->customerRepository->getQueryForDebug($offset, $limit);
}
}

0 comments on commit 8fb1d47

Please sign in to comment.