/**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $charId = $owner->getCharacterId();
     $api = $pheal->charScope->Contracts(array('characterID' => $charId));
     foreach ($api->contractList as $entry) {
         $contract = $this->loadOrCreate($entry->contractID, $charId);
         $contract->setIssuerId($entry->issuerID);
         $contract->setIssuerCorpId($entry->issuerCorpID);
         $contract->setAssigneeId($entry->assigneeID);
         $contract->setAcceptorId($entry->acceptorID);
         $contract->setStartStationId($entry->startStationID);
         $contract->setEndStationId($entry->endStationID);
         $contract->setType($entry->type);
         $contract->setStatus($entry->status);
         $contract->setTitle($entry->title);
         $contract->setForCorp(filter_var($entry->forCorp, FILTER_VALIDATE_BOOLEAN));
         $contract->setDateIssued(new \DateTime($entry->dateIssued));
         $contract->setDateExpired(new \DateTime($entry->dateExpired));
         $contract->setDateAccepted(new \DateTime($entry->dateAccepted));
         $contract->setNumDays($entry->numDays);
         $contract->setDateCompleted(new \DateTime($entry->dateCompleted));
         $contract->setPrice($entry->price);
         $contract->setReward($entry->reward);
         $contract->setCollateral($entry->collateral);
         $contract->setVolume($entry->volume);
         $contract->setAvailability($entry->availability);
         $contract->setBuyout($entry->buyout);
         $this->entityManager->flush($contract);
     }
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $charId = $call->getOwner()->getCharacterId();
     $query = 'delete from TariochEveapiFetcherBundle:CharContact c where c.ownerId=:ownerId';
     $this->entityManager->createQuery($query)->setParameter('ownerId', $charId)->execute();
     $query = 'delete from TariochEveapiFetcherBundle:CharCorporateContact c where c.ownerId=:ownerId';
     $this->entityManager->createQuery($query)->setParameter('ownerId', $charId)->execute();
     $query = 'delete from TariochEveapiFetcherBundle:CharAllianceContact c where c.ownerId=:ownerId';
     $this->entityManager->createQuery($query)->setParameter('ownerId', $charId)->execute();
     $api = $pheal->charScope->ContactList(array('characterID' => $charId));
     foreach ($api->contactList as $contactApi) {
         $entity = new CharContact($charId, $contactApi->contactID);
         $entity->setContactName($contactApi->contactName);
         $entity->setStanding($contactApi->standing);
         $this->entityManager->persist($entity);
     }
     foreach ($api->corporateContactList as $contactApi) {
         $entity = new CharCorporateContact($charId, $contactApi->contactID);
         $entity->setContactName($contactApi->contactName);
         $entity->setStanding($contactApi->standing);
         $this->entityManager->persist($entity);
     }
     foreach ($api->allianceContactList as $contactApi) {
         $entity = new CharAllianceContact($charId, $contactApi->contactID);
         $entity->setContactName($contactApi->contactName);
         $entity->setStanding($contactApi->standing);
         $this->entityManager->persist($entity);
     }
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $charId = $owner->getCharacterId();
     $repo = $this->entityManager->getRepository('TariochEveapiFetcherBundle:CharMailMessage');
     $messages = $repo->loadMessagesWithoutBody($charId);
     $messageIds = array();
     foreach ($messages as $message) {
         $message->setBody('');
         $messageIds[$message->getMessageId()] = $message;
     }
     $cached = 'now';
     if (!empty($messageIds)) {
         foreach (array_keys($messageIds) as $id) {
             $api = $pheal->charScope->MailBodies(array('characterID' => $charId, 'ids' => $id));
             foreach ($api->messages as $message) {
                 $messageId = $message->messageID;
                 $entity = $messageIds[$messageId];
                 $entity->setBody((string) $message);
             }
             $cached = $api->cached_until;
         }
     }
     return $cached;
 }
 public function calculateEarliestNextCall(ApiCall $call)
 {
     $minutesToEarliestNextCall = $call->getApi()->getCallInterval() * (1 + $call->getErrorCount());
     $earliestNextCall = new \DateTime('now', new \DateTimeZone('UTC'));
     $earliestNextCall->add(new \DateInterval('PT' . $minutesToEarliestNextCall . 'M'));
     return $earliestNextCall;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $corpId = $owner->getCorporationId();
     $api = $pheal->corpScope->MemberTracking(array('extended' => 1));
     $this->entityManager->createQuery('delete from TariochEveapiFetcherBundle:CorpMemberTracking c where c.ownerId=:ownerId')->setParameter('ownerId', $corpId)->execute();
     foreach ($api->members as $member) {
         $entity = new CorpMemberTracking();
         $entity->setOwnerId($corpId);
         $entity->setCharacterId($member->characterID);
         $entity->setName($member->name);
         $entity->setStartDateTime(new \DateTime($member->startDateTime));
         $entity->setBaseId($member->baseID);
         $entity->setBase($member->base);
         $entity->setTitle($member->title);
         $entity->setLogonDateTime(new \DateTime($member->logonDateTime));
         $entity->setLogoffDateTime(new \DateTime($member->logoffDateTime));
         $entity->setLocationId($member->locationID);
         $entity->setLocation($member->location);
         $entity->setShipTypeId($member->shipTypeID);
         $entity->setShipType($member->shipType);
         $entity->setRoles($member->roles);
         $entity->setGrantableRoles($member->grantableRoles);
         $this->entityManager->persist($entity);
     }
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $charId = $owner->getCharacterId();
     $api = $pheal->charScope->AssetList(array('characterID' => $charId));
     $this->entityManager->createQuery('delete from TariochEveapiFetcherBundle:CharAsset c where c.ownerId=:ownerId')->setParameter('ownerId', $charId)->execute();
     $this->addAssets($api->assets, 0, 0, $charId);
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $corpId = $owner->getCorporationId();
     $api = $pheal->corpScope->customsOffices();
     $this->entityManager->createQuery('delete from TariochEveapiFetcherBundle:CorpCustomsOffice c where c.ownerId=:ownerId')->setParameter('ownerId', $corpId)->execute();
     $this->addCustomsOffices($api->pocos, $corpId);
     return $api->cached_until;
 }
 /**
  *
  * @param ApiCall $call
  * @return SectionApi
  */
 public function create(ApiCall $call)
 {
     $section = $call->getApi()->getSection();
     if (in_array($section, self::$keySections)) {
         return $this->keySectionApi;
     } else {
         return $this->noKeySectionApi;
     }
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $charId = $call->getOwner()->getCharacterId();
     $query = 'delete from TariochEveapiFetcherBundle:CharMailingList c where c.ownerId=:ownerId';
     $this->entityManager->createQuery($query)->setParameter('ownerId', $charId)->execute();
     $api = $pheal->charScope->MailingLists(array('characterID' => $charId));
     foreach ($api->mailingLists as $listApi) {
         $entity = new CharMailingList($charId, $listApi->listID);
         $entity->setDisplayName($listApi->displayName);
         $this->entityManager->persist($entity);
     }
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $charId = $owner->getCharacterId();
     $api = $pheal->charScope->AccountBalance(array('characterID' => $charId));
     foreach ($api->accounts as $account) {
         $entity = $this->loadOrCreate($account->accountID);
         $entity->setOwnerId($charId);
         $entity->setAccountKey($account->accountKey);
         $entity->setBalance($account->balance);
         $this->entityManager->flush($entity);
     }
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $charId = $call->getOwner()->getCharacterId();
     $api = $pheal->charScope->UpcomingCalendarEvents(array('characterID' => $charId));
     foreach ($api->upcomingEvents as $event) {
         $eventId = $event->eventID;
         $entity = $this->loadOrCreate($charId, $eventId);
         $entity->setEventOwnerId($event->ownerID);
         $entity->setEventOwnerName($event->ownerName);
         $entity->setEventDate(new \DateTime($event->eventDate));
         $entity->setEventTitle($event->eventTitle);
         $entity->setDuration($event->duration);
         $entity->setImportance(filter_var($event->importance, FILTER_VALIDATE_BOOLEAN));
         $entity->setEventText($event->eventText);
         $entity->setResponse($event->response);
         $this->entityManager->flush($entity);
     }
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $corpId = $owner->getCorporationId();
     $api = $pheal->corpScope->StarbaseList();
     $this->entityManager->createQuery('delete from TariochEveapiFetcherBundle:CorpStarbase cs where cs.ownerId=:ownerId')->setParameter('ownerId', $corpId)->execute();
     foreach ($api->starbases as $starbase) {
         $entity = new CorpStarbase($starbase->itemID);
         $entity->setOwnerId($corpId);
         $entity->setTypeId($starbase->typeID);
         $entity->setLocationId($starbase->locationID);
         $entity->setMoonId($starbase->moonID);
         $entity->setState($starbase->state);
         $entity->setStateTimestamp(new \DateTime($starbase->stateTimestamp));
         $entity->setOnlineTimestamp(new \DateTime($starbase->onlineTimestamp));
         $entity->setStandingOwnerId($starbase->standingOwnerID);
         $this->entityManager->persist($entity);
     }
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $charId = $call->getOwner()->getCharacterId();
     $api = $pheal->charScope->SkillInTraining(array('characterID' => $charId));
     $entity = new CharSkillInTraining($charId);
     $skillInTraining = $api->skillInTraining;
     $entity->setSkillInTraining($skillInTraining);
     if ($skillInTraining) {
         $entity->setTrainingStartTime(new \DateTime($api->trainingStartTime));
         $entity->setTrainingEndTime(new \DateTime($api->trainingEndTime));
         $entity->setTrainingTypeId($api->trainingTypeID);
         $entity->setTrainingStartSp($api->trainingStartSP);
         $entity->setTrainingDestinationSp($api->trainingDestinationSP);
         $entity->setTrainingToLevel($api->trainingToLevel);
     }
     $query = 'delete from TariochEveapiFetcherBundle:CharSkillInTraining c where c.characterId=:characterId';
     $this->entityManager->createQuery($query)->setParameter('characterId', $charId)->execute();
     $this->entityManager->persist($entity);
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $charId = $owner->getCharacterId();
     $corpId = $owner->getCorporationId();
     $accountRepo = $this->entityManager->getRepository('TariochEveapiFetcherBundle:CorpAccountBalance');
     $accounts = $accountRepo->findByOwnerId($corpId);
     $cached = 'now';
     foreach ($accounts as $account) {
         $accountKey = $account->getAccountKey();
         $api = $pheal->corpScope->WalletTransactions(array('characterID' => $charId, 'rowCount' => 2560, 'accountKey' => $accountKey));
         $cached = $api->cached_until;
         $repo = $this->entityManager->getRepository('TariochEveapiFetcherBundle:CorpWalletTransaction');
         foreach ($api->transactions as $transaction) {
             $transId = $transaction->transactionID;
             $criteria = array('transactionId' => $transId, 'ownerId' => $corpId, 'accountKey' => $accountKey);
             $entity = $repo->findOneBy($criteria);
             if ($entity === null) {
                 $entity = new CorpWalletTransaction($transId, $corpId, $accountKey);
                 $this->entityManager->persist($entity);
                 $entity->setJournalTransactionId($transaction->journalTransactionID);
                 $entity->setTransactionDateTime(new \DateTime($transaction->transactionDateTime));
                 $entity->setQuantity($transaction->quantity);
                 $entity->setTypeName($transaction->typeName);
                 $entity->setTypeId($transaction->typeID);
                 $entity->setPrice($transaction->price);
                 $entity->setClientId($transaction->clientID);
                 $entity->setClientName($transaction->clientName);
                 $entity->setClientTypeId($transaction->clientTypeID);
                 $entity->setStationId($transaction->stationID);
                 $entity->setStationName($transaction->stationName);
                 $entity->setTransactionType($transaction->transactionType);
                 $entity->setTransactionFor($transaction->transactionFor);
                 $entity->setCharacterId($transaction->characterID);
                 $entity->setCharacterName($transaction->characterName);
                 $this->entityManager->flush($entity);
             }
         }
     }
     return $cached;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $charId = $owner->getCharacterId();
     $this->entityManager->createQuery('delete from TariochEveapiFetcherBundle:CharPlanetaryColony c where c.ownerId=:ownerId')->setParameter('ownerId', $charId)->execute();
     $this->entityManager->createQuery('delete from TariochEveapiFetcherBundle:CharPlanetaryPin c where c.ownerId=:ownerId')->setParameter('ownerId', $charId)->execute();
     $this->entityManager->createQuery('delete from TariochEveapiFetcherBundle:CharPlanetaryLink c where c.ownerId=:ownerId')->setParameter('ownerId', $charId)->execute();
     $this->entityManager->createQuery('delete from TariochEveapiFetcherBundle:CharPlanetaryRoute c where c.ownerId=:ownerId')->setParameter('ownerId', $charId)->execute();
     $api = $pheal->charScope->PlanetaryColonies(array('characterID' => $charId));
     foreach ($api->colonies as $colony) {
         $planetId = $colony->planetID;
         $this->addColony($colony, $charId);
         $api = $pheal->charScope->PlanetaryPins(array('characterID' => $charId, 'planetID' => $planetId));
         $this->addPins($api->pins, $planetId, $charId);
         $api = $pheal->charScope->PlanetaryLinks(array('characterID' => $charId, 'planetID' => $planetId));
         $this->addLinks($api->links, $planetId, $charId);
         $api = $pheal->charScope->PlanetaryRoutes(array('characterID' => $charId, 'planetID' => $planetId));
         $this->addRoutes($api->routes, $planetId, $charId);
     }
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $charId = $owner->getCharacterId();
     $accountRepo = $this->entityManager->getRepository('TariochEveapiFetcherBundle:CharAccountBalance');
     $accounts = $accountRepo->findByOwnerId($charId);
     $cached = 'now';
     foreach ($accounts as $account) {
         $accountKey = $account->getAccountKey();
         $api = $pheal->charScope->WalletJournal(array('characterID' => $charId, 'rowCount' => 2560, 'accountKey' => $accountKey));
         $cached = $api->cached_until;
         $repo = $this->entityManager->getRepository('TariochEveapiFetcherBundle:CharWalletJournal');
         foreach ($api->transactions as $entry) {
             $refId = $entry->refID;
             $entity = $repo->findOneBy(array('refId' => $refId, 'ownerId' => $charId));
             if ($entity === null) {
                 $entity = new CharWalletJournal($refId, $charId);
                 $this->entityManager->persist($entity);
                 $entity->setAccountKey($accountKey);
                 $entity->setDate(new \DateTime($entry->date));
                 $entity->setRefTypeId($entry->refTypeID);
                 $entity->setOwnerName1($entry->ownerName1);
                 $entity->setOwnerId1($entry->ownerID1);
                 $entity->setOwnerName2($entry->ownerName2);
                 $entity->setOwnerId2($entry->ownerID2);
                 $entity->setArgName1($entry->argName1);
                 $entity->setArgId1($entry->argID1);
                 $entity->setAmount($entry->amount);
                 $entity->setBalance($entry->balance);
                 $entity->setReason($entry->reason);
                 $entity->setOwner1TypeId($entry->owner1TypeID);
                 $entity->setOwner2TypeId($entry->owner2TypeID);
                 $entity->setTaxAmount((double) $entry->taxAmount);
                 $entity->setTaxReceiverId($entry->taxReceiverID === '' ? null : $entry->taxReceiverID);
                 $this->entityManager->flush($entity);
             }
         }
     }
     return $cached;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $charId = $call->getOwner()->getCharacterId();
     $api = $pheal->corpScope->CorporationSheet(array('characterID' => $charId));
     $entity = $this->loadOrCreate($api->corporationID);
     $entity->setCorporationName($api->corporationName);
     $entity->setTicker($api->ticker);
     $entity->setCeoId($api->ceoID);
     $entity->setCeoName($api->ceoName);
     $entity->setStationId($api->stationID);
     $entity->setStationName($api->stationName);
     $entity->setDescription($api->description);
     $entity->setUrl($api->url);
     $entity->setAllianceId($api->allianceID);
     $entity->setAllianceName($api->allianceName);
     $entity->setTaxRate($api->taxRate);
     $entity->setMemberCount($api->memberCount);
     $entity->setMemberLimit($api->memberLimit);
     $entity->setShares($api->shares);
     $logoEntity = $entity->getLogo();
     $logoApi = $api->logo;
     $logoEntity->setGraphicId($logoApi->graphicID);
     $logoEntity->setShape1($logoApi->shape1);
     $logoEntity->setShape2($logoApi->shape2);
     $logoEntity->setShape3($logoApi->shape3);
     $logoEntity->setColor1($logoApi->color1);
     $logoEntity->setColor2($logoApi->color2);
     $logoEntity->setColor3($logoApi->color3);
     foreach ($api->divisions as $division) {
         $accountKey = $division->accountKey;
         $divisionEntity = $this->loadOrCreateDivision($entity, $accountKey);
         $divisionEntity->setDescription($division->description);
     }
     foreach ($api->walletDivisions as $division) {
         $accountKey = $division->accountKey;
         $divisionEntity = $this->loadOrCreateWalletDivision($entity, $accountKey);
         $divisionEntity->setDescription($division->description);
     }
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $charId = $owner->getCharacterId();
     $corpId = $owner->getCorporationId();
     $api = $this->doApiCall($pheal, $charId);
     foreach ($api->jobs as $job) {
         $entity = $this->loadOrCreate($job->jobID, $corpId);
         $entity->setInstallerId($job->installerID);
         $entity->setInstallerName($job->installerName);
         $entity->setFacilityId($job->facilityID);
         $entity->setSolarSystemId($job->solarSystemID);
         $entity->setSolarSystemName($job->solarSystemName);
         $entity->setStationId($job->stationID);
         $entity->setActivityId($job->activityID);
         $entity->setBlueprintId($job->blueprintID);
         $entity->setBlueprintTypeId($job->blueprintTypeID);
         $entity->setBlueprintTypeName($job->blueprintTypeName);
         $entity->setBlueprintLocationId($job->blueprintLocationID);
         $entity->setOutputLocationId($job->outputLocationID);
         $entity->setRuns($job->runs);
         $entity->setCost($job->cost);
         $entity->setTeamId($job->teamID);
         $entity->setLicensedRuns($job->licensedRuns);
         $entity->setProbability($job->probability);
         $entity->setProductTypeId($job->productTypeID);
         $entity->setProductTypeName($job->productTypeName);
         $entity->setStatus($job->status);
         $entity->setTimeInSeconds($job->timeInSeconds);
         $entity->setStartDate(new \DateTime($job->startDate));
         $entity->setEndDate(new \DateTime($job->endDate));
         $entity->setPauseDate(new \DateTime($job->pauseDate));
         $entity->setCompletedDate(new \DateTime($job->completedDate));
         $entity->setCompletedCharacterId($job->completedCharacterID);
         $entity->setSuccessfulRuns($job->successfulRuns);
         $this->entityManager->flush($entity);
     }
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call)
 {
     $key = $call->getKey();
     if ($key->isActive()) {
         $pheal = $this->phealFactory->createEveOnline($key->getKeyId(), $key->getVcode());
         try {
             $updateService = $this->specificApiFactory->create($call->getApi());
             $cachedUntil = $updateService->update($call, $key, $pheal);
             $key->clearErrorCount();
             return new \DateTime($cachedUntil);
         } catch (PhealException $e) {
             $key->increaseErrorCount();
             if ($key->getErrorCount() > self::ERROR_MAX) {
                 $key->setActive(false);
             }
             throw $e;
         }
     } else {
         $call->setActive(false);
         return $call->getCachedUntil();
     }
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $owner = $call->getOwner();
     $charId = $owner->getCharacterId();
     $api = $pheal->charScope->MailMessages(array('characterID' => $charId));
     foreach ($api->messages as $message) {
         $messageId = $message->messageID;
         $repo = $this->entityManager->getRepository('TariochEveapiFetcherBundle:CharMailMessage');
         $entity = $repo->findBy(array('messageId' => $messageId, 'ownerId' => $charId));
         if ($entity === null) {
             $entity = new CharMailMessage($messageId, $charId);
             $this->entityManager->persist($entity);
             $entity->setSenderId($message->senderID);
             $entity->setSentDate(new \DateTime($message->sentDate));
             $entity->setTitle($message->title);
             $entity->setToCharacterIds($message->toCharacterIDs);
             $entity->setToCorpOrAllianceId($message->toCorpOrAllianceID);
             $entity->setToListId($message->toListID);
             $this->entityManager->persist($entity);
             $this->entityManager->flush($entity);
         }
     }
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call, ApiKey $key, Pheal $pheal)
 {
     $charId = $call->getOwner()->getCharacterId();
     $api = $pheal->charScope->CharacterSheet(array('characterID' => $charId));
     $entity = new CharCharacterSheet($charId);
     $entity->setName($api->name);
     $entity->setDateOfBirth(new \DateTime($api->DoB));
     $entity->setRace($api->race);
     $entity->setBloodLine($api->bloodLine);
     $entity->setAncestry($api->ancestry);
     $entity->setGender($api->gender);
     $entity->setCorporationId($api->corporationID);
     $entity->setCorporationName($api->corporationName);
     $entity->setAllianceId($api->allianceID);
     $entity->setAllianceName($api->allianceName);
     $entity->setCloneName($api->cloneName);
     $entity->setCloneSkillPoints($api->cloneSkillPoints);
     $entity->setBalance($api->balance);
     $attributes = new CharAttributes();
     $entity->setAttributes($attributes);
     $attributesApi = $api->attributes;
     $attributes->setIntelligence($attributesApi->intelligence);
     $attributes->setMemory($attributesApi->memory);
     $attributes->setCharisma($attributesApi->charisma);
     $attributes->setPerception($attributesApi->perception);
     $attributes->setWillpower($attributesApi->willpower);
     foreach ($api->skills as $skillApi) {
         $skill = new CharSkill($entity);
         $skill->setTypeId($skillApi->typeID);
         $skill->setLevel($skillApi->level);
         $skill->setSkillpoints($skillApi->skillpoints);
         $skill->setPublished(filter_var($skillApi->published, FILTER_VALIDATE_BOOLEAN));
         $entity->addSkill($skill);
     }
     foreach ($api->corporationRoles as $roleApi) {
         $role = new CharCorporationRole($entity);
         $role->setRoleId($roleApi->roleID);
         $role->setRoleName($roleApi->roleName);
         $entity->addCorporationRole($role);
     }
     foreach ($api->corporationRolesAtHQ as $roleApi) {
         $role = new CharCorporationRoleAtHq($entity);
         $role->setRoleId($roleApi->roleID);
         $role->setRoleName($roleApi->roleName);
         $entity->addCorporationRolesAtHq($role);
     }
     foreach ($api->corporationRolesAtBase as $roleApi) {
         $role = new CharCorporationRoleAtBase($entity);
         $role->setRoleId($roleApi->roleID);
         $role->setRoleName($roleApi->roleName);
         $entity->addCorporationRolesAtBase($role);
     }
     foreach ($api->corporationRolesAtOther as $roleApi) {
         $role = new CharCorporationRoleAtOther($entity);
         $role->setRoleId($roleApi->roleID);
         $role->setRoleName($roleApi->roleName);
         $entity->addCorporationRolesAtOther($role);
     }
     foreach ($api->corporationTitles as $titleApi) {
         $title = new CharCorporationTitle($entity);
         $title->setTitleId($titleApi->titleID);
         $title->setTitleName($titleApi->titleName);
         $entity->addCorporationTitle($title);
     }
     $query = 'delete from TariochEveapiFetcherBundle:CharCharacterSheet c where c.characterId=:characterId';
     $this->entityManager->createQuery($query)->setParameter('characterId', $charId)->execute();
     $this->entityManager->persist($entity);
     return $api->cached_until;
 }
 /**
  * @inheritdoc
  */
 public function update(ApiCall $call)
 {
     $pheal = $this->phealFactory->createEveOnline();
     $specificApi = $this->specificApiFactory->create($call->getApi());
     return new \DateTime($specificApi->update($call, $pheal));
 }