| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 23 | { |
||
| 24 | $gearman = $this->getContainer()->get('gearman'); |
||
| 25 | $entityManager = $this->getContainer()->get('doctrine.orm.eveapi_entity_manager'); |
||
| 26 | |||
| 27 | $newKeys = $entityManager->getRepository('TariochEveapiFetcherBundle:ApiKey')->loadKeysWithoutApiCall(); |
||
| 28 | if (!empty($newKeys)) { |
||
| 29 | $api = $entityManager->getRepository('TariochEveapiFetcherBundle:Api')->loadApiKeyInfoApi(); |
||
| 30 | foreach ($newKeys as $key) { |
||
| 31 | $entityManager->persist(new ApiCall($api, null, $key)); |
||
| 32 | } |
||
| 33 | $entityManager->flush(); |
||
| 34 | } |
||
| 35 | |||
| 36 | $calls = $entityManager->getRepository('TariochEveapiFetcherBundle:ApiCall')->loadReadyCalls(); |
||
| 37 | foreach ($calls as $call) { |
||
| 38 | $api = $call->getApi(); |
||
| 39 | |||
| 40 | $worker = $api->getWorker(); |
||
| 41 | $job = $worker . '~apiUpdate'; |
||
| 42 | $callId = $call->getApiCallId(); |
||
| 43 | |||
| 44 | $gearman->doBackgroundJob($job, $callId, $callId); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 |