marketplaceProformaRepository = $marketplaceProformaRepository; $this->marketplaceProductRepository = $marketplaceProductRepository; $this->facturisProformaRepository = $facturisProformaRepository; $this->facturisCustomerRepository = $facturisCustomerRepository; $this->facturisProductRepository = $facturisProductRepository; $this->settingsRepository = $settingsRepository; } public function sync() { $facturisCustomers = $this->facturisCustomerRepository->getAll(); $facturisProducts = $this->facturisProductRepository->getAll(); $this->marketplaceProformaRepository->setRemoteCustomers($facturisCustomers); $this->marketplaceProformaRepository->setRemoteProducts($facturisProducts); $this->marketplaceProformaRepository->setOrderedDaysAgo($this->settingsRepository->getOptionOrderedDaysAgo()); $this->marketplaceProformaRepository->setProformaSerie($this->settingsRepository->getOptionProformaSerie()); $withOutDiscount = true; $marketplaceProducts = $this->marketplaceProductRepository->getAll($withOutDiscount); $this->marketplaceProformaRepository->setLocalProducts((array) $marketplaceProducts); $this->marketplaceProformaRepository->setWithDiscount($this->settingsRepository->getOptionWithDiscount()); $marketplaceProformas = $this->marketplaceProformaRepository->getAll(); if(!empty($marketplaceProformas)) { foreach($marketplaceProformas as $marketplaceProforma) { $result = $this->facturisProformaRepository->add($marketplaceProforma); //$this->marketplaceProformaRepository->addProforma($marketplaceProforma, $result); } } } }