예제 #1
0
 public function load(ObjectManager $manager)
 {
     $stats1 = new Stats();
     $stats1->setStamina(10);
     $stats1->setStrength(15);
     $stats1->setAgility(20);
     $stats1->setStrike(10);
     $stats1->setIntelligence(10);
     $stats1->setGrappling(15);
     $stats1->setTakedown(20);
     $stats1->setKicking(10);
     $stats1->setFighter($this->getReference('fighter1'));
     $this->getReference('fighter1')->setStats($stats1);
     $manager->persist($stats1);
     $stats2 = new Stats();
     $stats2->setStamina(20);
     $stats2->setStrength(25);
     $stats2->setAgility(20);
     $stats2->setStrike(10);
     $stats2->setIntelligence(10);
     $stats2->setGrappling(25);
     $stats2->setTakedown(20);
     $stats2->setKicking(10);
     $stats2->setFighter($this->getReference('fighter2'));
     $this->getReference('fighter2')->setStats($stats2);
     $manager->persist($stats2);
     $stats3 = new Stats();
     $stats3->setStamina(20);
     $stats3->setStrength(5);
     $stats3->setAgility(25);
     $stats3->setStrike(10);
     $stats3->setIntelligence(10);
     $stats3->setGrappling(25);
     $stats3->setTakedown(20);
     $stats3->setKicking(15);
     $stats3->setFighter($this->getReference('fighter3'));
     $this->getReference('fighter3')->setStats($stats3);
     $manager->persist($stats3);
     $stats4 = new Stats();
     $stats4->setStamina(30);
     $stats4->setStrength(15);
     $stats4->setAgility(69);
     $stats4->setStrike(10);
     $stats4->setIntelligence(10);
     $stats4->setGrappling(25);
     $stats4->setTakedown(20);
     $stats4->setKicking(15);
     $stats4->setFighter($this->getReference('fighter4'));
     $this->getReference('fighter4')->setStats($stats4);
     $manager->persist($stats4);
     $stats5 = new Stats();
     $stats5->setStamina(30);
     $stats5->setStrength(15);
     $stats5->setAgility(69);
     $stats5->setStrike(10);
     $stats5->setIntelligence(10);
     $stats5->setGrappling(25);
     $stats5->setTakedown(20);
     $stats5->setKicking(15);
     $stats5->setFighter($this->getReference('fighter5'));
     $this->getReference('fighter5')->setStats($stats5);
     $manager->persist($stats5);
     $stats6 = new Stats();
     $stats6->setStamina(30);
     $stats6->setStrength(15);
     $stats6->setAgility(69);
     $stats6->setStrike(10);
     $stats6->setIntelligence(10);
     $stats6->setGrappling(25);
     $stats6->setTakedown(20);
     $stats6->setKicking(15);
     $stats6->setFighter($this->getReference('fighter6'));
     $this->getReference('fighter6')->setStats($stats6);
     $manager->persist($stats6);
     $stats7 = new Stats();
     $stats7->setStamina(30);
     $stats7->setStrength(15);
     $stats7->setAgility(69);
     $stats7->setStrike(10);
     $stats7->setIntelligence(10);
     $stats7->setGrappling(25);
     $stats7->setTakedown(20);
     $stats7->setKicking(15);
     $stats7->setFighter($this->getReference('fighter7'));
     $this->getReference('fighter7')->setStats($stats7);
     $manager->persist($stats7);
     $stats8 = new Stats();
     $stats8->setStamina(30);
     $stats8->setStrength(15);
     $stats8->setAgility(69);
     $stats8->setStrike(10);
     $stats8->setIntelligence(10);
     $stats8->setGrappling(25);
     $stats8->setTakedown(20);
     $stats8->setKicking(15);
     $stats8->setFighter($this->getReference('fighter8'));
     $this->getReference('fighter8')->setStats($stats8);
     $manager->persist($stats8);
     $stats9 = new Stats();
     $stats9->setStamina(30);
     $stats9->setStrength(15);
     $stats9->setAgility(69);
     $stats9->setStrike(10);
     $stats9->setIntelligence(10);
     $stats9->setGrappling(25);
     $stats9->setTakedown(20);
     $stats9->setKicking(15);
     $stats9->setFighter($this->getReference('fighter9'));
     $this->getReference('fighter9')->setStats($stats9);
     $manager->persist($stats9);
     $stats10 = new Stats();
     $stats10->setStamina(30);
     $stats10->setStrength(15);
     $stats10->setAgility(69);
     $stats10->setStrike(10);
     $stats10->setIntelligence(10);
     $stats10->setGrappling(25);
     $stats10->setTakedown(20);
     $stats10->setKicking(15);
     $stats10->setFighter($this->getReference('fighter10'));
     $this->getReference('fighter10')->setStats($stats10);
     $manager->persist($stats10);
     $stats11 = new Stats();
     $stats11->setStamina(30);
     $stats11->setStrength(15);
     $stats11->setAgility(69);
     $stats11->setStrike(10);
     $stats11->setIntelligence(10);
     $stats11->setGrappling(25);
     $stats11->setTakedown(20);
     $stats11->setKicking(15);
     $stats11->setFighter($this->getReference('fighter11'));
     $this->getReference('fighter11')->setStats($stats11);
     $manager->persist($stats11);
     $stats12 = new Stats();
     $stats12->setStamina(30);
     $stats12->setStrength(15);
     $stats12->setAgility(69);
     $stats12->setStrike(10);
     $stats12->setIntelligence(10);
     $stats12->setGrappling(25);
     $stats12->setTakedown(20);
     $stats12->setKicking(15);
     $stats12->setFighter($this->getReference('fighter12'));
     $this->getReference('fighter12')->setStats($stats12);
     $manager->persist($stats12);
     $stats13 = new Stats();
     $stats13->setStamina(30);
     $stats13->setStrength(15);
     $stats13->setAgility(69);
     $stats13->setStrike(10);
     $stats13->setIntelligence(10);
     $stats13->setGrappling(25);
     $stats13->setTakedown(20);
     $stats13->setKicking(15);
     $stats13->setFighter($this->getReference('fighter13'));
     $this->getReference('fighter13')->setStats($stats13);
     $manager->persist($stats13);
     $stats14 = new Stats();
     $stats14->setStamina(30);
     $stats14->setStrength(15);
     $stats14->setAgility(69);
     $stats14->setStrike(10);
     $stats14->setIntelligence(10);
     $stats14->setGrappling(25);
     $stats14->setTakedown(20);
     $stats14->setKicking(15);
     $stats14->setFighter($this->getReference('fighter14'));
     $this->getReference('fighter14')->setStats($stats14);
     $manager->persist($stats14);
     $stats15 = new Stats();
     $stats15->setStamina(30);
     $stats15->setStrength(15);
     $stats15->setAgility(69);
     $stats15->setStrike(10);
     $stats15->setIntelligence(10);
     $stats15->setGrappling(25);
     $stats15->setTakedown(20);
     $stats15->setKicking(15);
     $stats15->setFighter($this->getReference('fighter15'));
     $this->getReference('fighter15')->setStats($stats15);
     $manager->persist($stats15);
     $stats16 = new Stats();
     $stats16->setStamina(30);
     $stats16->setStrength(15);
     $stats16->setAgility(69);
     $stats16->setStrike(10);
     $stats16->setIntelligence(10);
     $stats16->setGrappling(25);
     $stats16->setTakedown(20);
     $stats16->setKicking(15);
     $stats16->setFighter($this->getReference('fighter16'));
     $this->getReference('fighter16')->setStats($stats16);
     $manager->persist($stats16);
     $manager->flush();
     $this->addReference('stats1', $stats1);
     $this->addReference('stats2', $stats2);
     $this->addReference('stats3', $stats3);
     $this->addReference('stats4', $stats4);
     $this->addReference('stats5', $stats5);
     $this->addReference('stats6', $stats6);
     $this->addReference('stats7', $stats7);
     $this->addReference('stats8', $stats8);
     $this->addReference('stats9', $stats9);
     $this->addReference('stats10', $stats10);
     $this->addReference('stats11', $stats11);
     $this->addReference('stats12', $stats12);
     $this->addReference('stats13', $stats13);
     $this->addReference('stats14', $stats14);
     $this->addReference('stats15', $stats15);
     $this->addReference('stats16', $stats16);
 }
 private function addFighter($rawItem, $managerId)
 {
     $em = $this->getDoctrine()->getManager();
     /** @var ManagerRepository $managerRepository */
     $managerRepository = $em->getRepository('GameBaseBundle:Manager');
     $manager = $managerRepository->getManagerByExternalId($managerId);
     $fighter = new Fighter();
     $fighter->setName($rawItem->name)->setAvatar('default.jpg')->setManager($manager);
     $stats = new Stats();
     $stats->setStamina($rawItem->stamina)->setStrength($rawItem->strength)->setAgility($rawItem->agility)->setIntelligence($rawItem->intelligence)->setStrike($rawItem->striking)->setGrappling($rawItem->grappling)->setTakedown($rawItem->takedown)->setKicking($rawItem->kicking)->setFighter($fighter);
     $em->persist($fighter);
     $em->persist($stats);
     $em->flush();
 }