/** * Execute the job. * * @return void */ public function handle() { echo "Retrieving " . (string) $this->request->getUri() . "\n"; $client = new Client(); /** @var TaxonomyTerm $term */ $term = $client->getEntity($this->request); if (empty($term->tid)) { echo "Skipping empty term " . (string) $this->request->getUri() . "\n"; return; } $repo = new TermRepository(); $repo->saveEntity($term); }
/** * Execute the job. * * @return void */ public function handle() { echo "Retrieving " . (string) $this->request->getUri() . ".\n"; $client = new Client(); $collection = $client->getEntity($this->request); $repo = new TermRepository(); /** @var TaxonomyTerm $term */ foreach ($collection as $term) { $repo->saveEntity($term); } if ($next_url = $collection->getNextLink()) { $next_url_params = []; parse_str($next_url->getQuery(), $next_url_params); $this->dispatch(new RetrieveTermCollectionJob(new TaxonomyTermCollectionRequest($next_url_params), $this->options)); } }