123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace Controller;
- class StockController
- {
- public $settingsRepository;
- public function __construct($settingsRepository)
- {
- $this->settingsRepository = $settingsRepository;
- }
- public function sync()
- {
- $marketplaceStockRepository = new \MarketplaceRepository\StockRepository(
- $this->settingsRepository->getToken(),
- $this->settingsRepository->getShop()
- );
- $marketplaceProductRepository = new \MarketplaceRepository\ProductRepository(
- $this->settingsRepository->getToken(),
- $this->settingsRepository->getShop()
- );
- $facturisStockRepository = new \Core\FacturisRepository\StockRepository(
- $this->settingsRepository->getAuthApiKey(),
- $this->settingsRepository->getAuthUsername(),
- $this->settingsRepository->getAuthPassword(),
- $this->settingsRepository->getAuthFiscalCode()
- );
-
- $service = new \Core\App\Service\StockService(
- $marketplaceStockRepository,
- $marketplaceProductRepository,
- $facturisStockRepository,
- $this->settingsRepository
- );
-
- $service->sync();
- }
- public function autoSync()
- {
- if($this->settingsRepository->getOptionAutoStockSync() == \Core\App\Factory\SettingsFactory::AUTO_SYNC_ENABLED)
- {
- $this->sync();
- }
- }
-
- }
|