1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace Core\App\Service;
- class StockService{
- protected $marketplaceStockRepository;
- protected $facturisStockRepository;
- protected $settingsRepository;
- protected $marketplaceProductRepository;
- public function __construct(
- \Core\App\Repository\Marketplace\StockInterface $marketplaceStockRepository,
- \Core\App\Repository\Marketplace\ProductInterface $marketplaceProductRepository,
- \Core\App\Repository\Facturis\StockInterface $facturisStockRepository,
- \Core\App\Repository\Marketplace\SettingsInterface $settingsRepository
- )
- {
- $this->marketplaceStockRepository = $marketplaceStockRepository;
- $this->marketplaceProductRepository = $marketplaceProductRepository;
- $this->facturisStockRepository = $facturisStockRepository;
- $this->settingsRepository = $settingsRepository;
- }
- public function sync() {
- $this->facturisStockRepository->setOptionStockFilter($this->settingsRepository->getOptionStockFilter());
- $this->facturisStockRepository->setLocalProducts($this->marketplaceProductRepository->getAll());
- $facturisStock = $this->facturisStockRepository->getAll();
- $this->marketplaceStockRepository->setStockLocations($this->settingsRepository->getOptionLocations());
- $this->marketplaceStockRepository->setLocalProducts($this->marketplaceProductRepository->getAll());
- $this->marketplaceStockRepository->update($facturisStock);
- }
- }
|