Conditions | 2 |
Paths | 2 |
Total Lines | 27 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
19 | public function update(ApiCall $call, ApiKey $key, Pheal $pheal) |
||
20 | { |
||
21 | $charId = $call->getOwner()->getCharacterId(); |
||
22 | |||
23 | $api = $pheal->charScope->SkillInTraining(array('characterID' => $charId)); |
||
24 | |||
25 | $entity = new CharSkillInTraining($charId); |
||
26 | $skillInTraining = $api->skillInTraining; |
||
27 | $entity->setSkillInTraining($skillInTraining); |
||
28 | if ($skillInTraining) { |
||
29 | $entity->setTrainingStartTime(new \DateTime($api->trainingStartTime)); |
||
30 | $entity->setTrainingEndTime(new \DateTime($api->trainingEndTime)); |
||
31 | $entity->setTrainingTypeId($api->trainingTypeID); |
||
32 | $entity->setTrainingStartSp($api->trainingStartSP); |
||
33 | $entity->setTrainingDestinationSp($api->trainingDestinationSP); |
||
34 | $entity->setTrainingToLevel($api->trainingToLevel); |
||
35 | } |
||
36 | |||
37 | $query = 'delete from TariochEveapiFetcherBundle:CharSkillInTraining c where c.characterId=:characterId'; |
||
38 | $this->entityManager |
||
39 | ->createQuery($query) |
||
40 | ->setParameter('characterId', $charId) |
||
41 | ->execute(); |
||
42 | |||
43 | $this->entityManager->persist($entity); |
||
44 | return $api->cached_until; |
||
45 | } |
||
46 | } |
||
47 |