SyncAsirPricesCommand
extends ContainerAwareCommand
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor.
- configure() : mixed
- Configure command
- execute() : void
- Executes the sync command.
- adjustPricesBasedOnStock() : array<string|int, mixed>
- Adjust prices based on stock and price histories.
- createFallbackPriceJson() : array<string|int, mixed>
- Create fallback price JSON object.
- dropTmpTables() : void
- Drops the temporary table if it exists.
- exportCatalogDbResults() : void
- Export catalog DB results to a CSV file.
- fetchMainDbResults() : array<string|int, mixed>
- Fetch results from the main DB.
- formatPriceHistories() : array<string|int, mixed>
- Format price histories for easy access.
- generateCatalogDbSql() : array<string|int, mixed>
- Generate SQL statements for catalog DB. This method returns the SQL queries to be executed in the catalog DB.
- generateMainDbSql() : string
- Generate SQL statements for main DB. This method returns the SQL queries to be executed in the main DB.
- getCatalogDbSqlForRegularPrice() : string
- Generate SQL for updating regular price in the catalog DB.
- getCatalogDbSqlForSpecialPrice() : string
- Generate SQL for updating special price in the catalog DB.
- getMainDbConnection() : mixed
- Get connection for main DB from EntityManager.
- getMainDbSqlForRegularPrice() : string
- Generate SQL for updating regular price in the main DB.
- getMainDbSqlForSpecialPrice() : string
- Generate SQL for updating special price in the main DB.
- getPriceHistories() : array<string|int, mixed>
- Fetch price histories from the temporary table.
- getPromoToDate() : string
- Get promotion end date.
- initTmpTables() : void
- Initializes regular tables with indexed columns for better query performance.
- processMainDbResults() : void
- Process the results and write to CSV for main DB.
Properties
$asirProductService
private
ProductService
$asirProductService
Methods
__construct()
Constructor.
public
__construct([string|null $name = null ][, ProductService|null $productService = null ]) : mixed
Parameters
- $name : string|null = null
- $productService : ProductService|null = null
configure()
Configure command
protected
configure() : mixed
execute()
Executes the sync command.
protected
execute(InputInterface $input, OutputInterface $output) : void
Parameters
- $input : InputInterface
- $output : OutputInterface
adjustPricesBasedOnStock()
Adjust prices based on stock and price histories.
private
adjustPricesBasedOnStock(array<string|int, mixed> $result, float $price, float $specialPrice, array<string|int, mixed> $priceHistoriesF) : array<string|int, mixed>
Parameters
- $result : array<string|int, mixed>
- $price : float
- $specialPrice : float
- $priceHistoriesF : array<string|int, mixed>
Return values
array<string|int, mixed>createFallbackPriceJson()
Create fallback price JSON object.
private
createFallbackPriceJson(int $internalStockQty, float $regularPrice, float $price, float|null $specialPrice, string|null $specialPriceFrom, string|null $specialPriceTo) : array<string|int, mixed>
Parameters
- $internalStockQty : int
- $regularPrice : float
- $price : float
- $specialPrice : float|null
- $specialPriceFrom : string|null
- $specialPriceTo : string|null
Return values
array<string|int, mixed>dropTmpTables()
Drops the temporary table if it exists.
private
dropTmpTables(mixed $connection) : void
Parameters
- $connection : mixed
exportCatalogDbResults()
Export catalog DB results to a CSV file.
private
exportCatalogDbResults(string $filePath, array<string|int, mixed> $sqlQueries, OutputInterface $output) : void
Parameters
- $filePath : string
- $sqlQueries : array<string|int, mixed>
- $output : OutputInterface
fetchMainDbResults()
Fetch results from the main DB.
private
fetchMainDbResults(mixed $connection) : array<string|int, mixed>
Parameters
- $connection : mixed
Return values
array<string|int, mixed>formatPriceHistories()
Format price histories for easy access.
private
formatPriceHistories(array<string|int, mixed> $priceHistories) : array<string|int, mixed>
Parameters
- $priceHistories : array<string|int, mixed>
Return values
array<string|int, mixed>generateCatalogDbSql()
Generate SQL statements for catalog DB. This method returns the SQL queries to be executed in the catalog DB.
private
generateCatalogDbSql(array<string|int, mixed> $results) : array<string|int, mixed>
Parameters
- $results : array<string|int, mixed>
Return values
array<string|int, mixed>generateMainDbSql()
Generate SQL statements for main DB. This method returns the SQL queries to be executed in the main DB.
private
generateMainDbSql(array<string|int, mixed> $result, float $price, float|null $specialPrice, string $promoTo) : string
Parameters
- $result : array<string|int, mixed>
- $price : float
- $specialPrice : float|null
- $promoTo : string
Return values
stringgetCatalogDbSqlForRegularPrice()
Generate SQL for updating regular price in the catalog DB.
private
getCatalogDbSqlForRegularPrice(int $sourceId, float $price) : string
Parameters
- $sourceId : int
- $price : float
Return values
stringgetCatalogDbSqlForSpecialPrice()
Generate SQL for updating special price in the catalog DB.
private
getCatalogDbSqlForSpecialPrice(int $sourceId, float $specialPrice, string $promoTo) : string
Parameters
- $sourceId : int
- $specialPrice : float
- $promoTo : string
Return values
stringgetMainDbConnection()
Get connection for main DB from EntityManager.
private
getMainDbConnection() : mixed
getMainDbSqlForRegularPrice()
Generate SQL for updating regular price in the main DB.
private
getMainDbSqlForRegularPrice(int $sourceId, float $price) : string
Parameters
- $sourceId : int
- $price : float
Return values
stringgetMainDbSqlForSpecialPrice()
Generate SQL for updating special price in the main DB.
private
getMainDbSqlForSpecialPrice(int $sourceId, float $price, float $specialPrice, string $promoTo) : string
Parameters
- $sourceId : int
- $price : float
- $specialPrice : float
- $promoTo : string
Return values
stringgetPriceHistories()
Fetch price histories from the temporary table.
private
getPriceHistories(mixed $connection) : array<string|int, mixed>
Parameters
- $connection : mixed
Return values
array<string|int, mixed>getPromoToDate()
Get promotion end date.
private
getPromoToDate() : string
Return values
stringinitTmpTables()
Initializes regular tables with indexed columns for better query performance.
private
initTmpTables(mixed $connection) : void
Parameters
- $connection : mixed
processMainDbResults()
Process the results and write to CSV for main DB.
private
processMainDbResults(string $filePath, array<string|int, mixed> $results, array<string|int, mixed> $priceHistoriesF, OutputInterface $output) : void
Parameters
- $filePath : string
- $results : array<string|int, mixed>
- $priceHistoriesF : array<string|int, mixed>
- $output : OutputInterface