logger = $logger; $this->helper = $helper; $this->netSuiteAPI = $netSuiteAPI; $this->locationResourceModel = $locationResourceModel; } /** * @return array */ public function sync() { $result = [ 'error' => false, 'message' => 'Locations saved successfully.' ]; $this->logger->info('Start Locations Sync'); $this->logger->info('Fetching locations from NetSuite'); $locations = $this->netSuiteAPI->fetchLocations(); if (isset($locations['error'])) { $result['error'] = true; $result['message'] = $locations['message']; $this->logger->info('Error while fetching locations from NetSuite: ' . $locations['message']); return $result; } $this->logger->info('Locations fetched successfully'); $this->logger->info('Start saving locations'); $this->locationResourceModel->saveLocations($locations['data']); $this->logger->info('Locations saved successfully'); $this->logger->info('End Locations Sync'); return $result; } }