Conditions | 4 |
Paths | 5 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
36 | protected function execute(InputInterface $input, OutputInterface $output) |
||
37 | { |
||
38 | $queueItems = $this->repository->findAllWithMovies(0)->getResult(); |
||
39 | |||
40 | $i = 0; |
||
41 | /** @var $queueItem ReleaseDateQueue */ |
||
42 | foreach ($queueItems as $queueItem) { |
||
43 | $movie = $queueItem->getMovie(); |
||
44 | $tmdbId = $movie->getTmdb()->getId(); |
||
45 | if (null !== $imdbId = $this->imdb->getImdbId($tmdbId)) { |
||
46 | $queueItem->activate(); |
||
47 | $movie->setImdbId($imdbId); |
||
48 | } |
||
49 | |||
50 | if ($i === 5) { |
||
51 | $i = 0; |
||
52 | sleep(5); |
||
53 | } |
||
54 | |||
55 | ++$i; |
||
56 | } |
||
57 | |||
58 | $this->em->flush(); |
||
59 | } |
||
60 | } |
||
61 |