class StatisticManager implements BasicEntityManagerInterface

Class StatisticManager is injected as alligator.statistic_manager service. StatisticManager handles the logic for managed entity.

Constants

WEB_DIR_PATH

BACKEND_STATISTIC_QUERIES_CACHED_FILENAME

Properties

protected StatisticRepository $repository
protected OrderManager $orderManager
protected UserManager $userManager

Methods

__construct(StatisticRepository $repository, OrderManager $orderManager, UserManager $userManager)

StatisticManager constructor.

array
loadGraphData(string|null $currency = null)

Retrieve data for statistics

array
retrieveStatisticDataFromFile(string $currency)

Cache all query results to file, and then read from there Cache is done if it is initial load of data for that day

array|null
loadOrderDetailsGraphData(string $lastOrderDate)

Retrieve data for statistics

array
loadGraphDataForInterval(string $dateFrom, string $dateTo, string|null $currency = null)

Retrieve data for statistics

array
loadAllPlatformGraphData()

Load statistics data for graph representation

array
loadPlatformPieGraphData()

Load statistics data for graph representation

saveStatistic(Statistics $statistics)

Persist new statistics

array
getBestSeller(int $maxResult)

Find best seller products, limit by $maxResult

array
getMostViewed(int $maxResult)

Find most viewed products, limit by $maxResult

array|bool
getTopRated(int $maxResult)

Find top rated products, limit by $maxResult

array
getTopProducts()

Find top products by review, limit by $maxResult

getFinancialGraphData(string|DateTime|null $currentDate = null, string|null $currency = null)

Find and format financial data for graph representation

array
getProductsForYearAndMonth(string|DateTime|null $currentDate = null, string|null $currency = null)

Find products for month and year

array
getDataForLiveActivityLog(int $page = 1, int $offset = 10, array|null $params = null)

Find last statistics data with pagination

array
getDataForOrderActivityLog(int $orderId)

Find order statistics data

bool
isOrderAlreadyCreated(Order $order)

Has statistics for order

array
getUsersByStringParam(int $page = 1, int $offset = 10, string|null $params = null)

Find user information with pagination

array
getLatestViewedProductsForUser(int|string $userId, int $numberOfProducts)

Find latest viewed products for specific user

array
getMostViewedProductsForUser(int|string $userId, int $numberOfProducts)

Find most viewed products for specific user

array
getAddedRemovedProductOlapData()

Find all data for OLAP

Details

at line 51
__construct(StatisticRepository $repository, OrderManager $orderManager, UserManager $userManager)

StatisticManager constructor.

Parameters

StatisticRepository $repository
OrderManager $orderManager
UserManager $userManager

at line 64
array loadGraphData(string|null $currency = null)

Retrieve data for statistics

Parameters

string|null $currency

Return Value

array

at line 76
array retrieveStatisticDataFromFile(string $currency)

Cache all query results to file, and then read from there Cache is done if it is initial load of data for that day

Parameters

string $currency

Return Value

array

at line 111
array|null loadOrderDetailsGraphData(string $lastOrderDate)

Retrieve data for statistics

Parameters

string $lastOrderDate

Return Value

array|null

at line 124
array loadGraphDataForInterval(string $dateFrom, string $dateTo, string|null $currency = null)

Retrieve data for statistics

Parameters

string $dateFrom
string $dateTo
string|null $currency

Return Value

array

at line 133
array loadAllPlatformGraphData()

Load statistics data for graph representation

Return Value

array

at line 142
array loadPlatformPieGraphData()

Load statistics data for graph representation

Return Value

array

at line 156
Statistics saveStatistic(Statistics $statistics)

Persist new statistics

Parameters

Statistics $statistics

Return Value

Statistics

Exceptions

ORMException
OptimisticLockException

at line 168
array getBestSeller(int $maxResult)

Find best seller products, limit by $maxResult

Parameters

int $maxResult

Return Value

array

at line 179
array getMostViewed(int $maxResult)

Find most viewed products, limit by $maxResult

Parameters

int $maxResult

Return Value

array

at line 190
array|bool getTopRated(int $maxResult)

Find top rated products, limit by $maxResult

Parameters

int $maxResult

Return Value

array|bool

at line 199
array getTopProducts()

Find top products by review, limit by $maxResult

Return Value

array

at line 211
stdClass getFinancialGraphData(string|DateTime|null $currentDate = null, string|null $currency = null)

Find and format financial data for graph representation

Parameters

string|DateTime|null $currentDate
string|null $currency

Return Value

stdClass

at line 257
array getProductsForYearAndMonth(string|DateTime|null $currentDate = null, string|null $currency = null)

Find products for month and year

Parameters

string|DateTime|null $currentDate
string|null $currency

Return Value

array

at line 284
array getDataForLiveActivityLog(int $page = 1, int $offset = 10, array|null $params = null)

Find last statistics data with pagination

Parameters

int $page
int $offset
array|null $params

Return Value

array

at line 295
array getDataForOrderActivityLog(int $orderId)

Find order statistics data

Parameters

int $orderId

Return Value

array

at line 306
bool isOrderAlreadyCreated(Order $order)

Has statistics for order

Parameters

Order $order

Return Value

bool

at line 319
array getUsersByStringParam(int $page = 1, int $offset = 10, string|null $params = null)

Find user information with pagination

Parameters

int $page
int $offset
string|null $params

Return Value

array

at line 331
array getLatestViewedProductsForUser(int|string $userId, int $numberOfProducts)

Find latest viewed products for specific user

Parameters

int|string $userId
int $numberOfProducts

Return Value

array

at line 343
array getMostViewedProductsForUser(int|string $userId, int $numberOfProducts)

Find most viewed products for specific user

Parameters

int|string $userId
int $numberOfProducts

Return Value

array

at line 354
array getAddedRemovedProductOlapData()

Find all data for OLAP

Return Value

array

Exceptions

DBALException