public function resolveType(Character $character = null) { if (null === $character) { return; } $typeResolver = $this->container->get('overblog_graphql.type_resolver'); return $typeResolver->resolve($character->getType()); }
public function persist(Character $character) { $found = $this->em->getRepository('AppBundle:Character')->find($character->getId()); // Only persist if it doesnt already exist. if (!$found) { $this->em->persist($character); } return true; }
public function getAllianceCorps(Character $char, Registry $doctrine) { $leaderCorp = $doctrine->getRepository('AppBundle:Corporation')->findByCorpName($char->getCorporationName()); if ($leaderCorp === null) { // this is bad return false; } $registeredAllianceCorps = $doctrine->getRepository('AppBundle:Corporation')->findCorporationsByAlliance($leaderCorp->getCorporationDetails()->getAllianceName()); return $registeredAllianceCorps; }
private function loadCharacters(ObjectManager $manager, array $characters, $type) { foreach ($characters as $data) { unset($data['friends']); $data['type'] = $type; $character = new Character(); $character->fromArray($data); $manager->persist($character); $metadata = $manager->getClassMetaData(get_class($character)); $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $manager->flush(); $this->characters[$character->getId()] = $character; } }
public function getKeysByCharacter(Character $char) { return $this->createQueryBuilder('api')->select('api')->andWhere('api.eve_character_id = :char_id')->andWhere('api.type IN (:types)')->setParameters(['char_id' => $char->getEveId(), 'types' => ['Character', 'Account']])->getQuery()->getResult(); }
public function newCharacterWithName(array $details) { $char = new Character(); $char->setEveId($details['id'])->setName($details['name']); return $char; }