<?php

namespace EJ\RPGBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use EJ\RPGBundle\Entity\Job;

class LoadJobData extends AbstractFixture implements OrderedFixtureInterface
{
    public function load(ObjectManager $manager)
    {
        $barbarian = new Job();
        $barbarian->setName("Bárbaro");
        $manager->persist($barbarian);

        $bard = new Job();
        $bard->setName("Bardo");
        $manager->persist($bard);

        $warlock = new Job();
        $warlock->setName("Bruxo");
        $manager->persist($warlock);

        $cleric = new Job();
        $cleric->setName("Clérigo");
        $manager->persist($cleric);

        $druid = new Job();
        $druid->setName("Druída");
        $manager->persist($druid);

        $sorcerer = new Job();
        $sorcerer->setName("Feiticeiro");
        $manager->persist($sorcerer);

        $fighter = new Job();
        $fighter->setName("Guerreiro");
        $manager->persist($fighter);

        $rogue = new Job();
        $rogue->setName("Ladino");
        $manager->persist($rogue);

        $wizard = new Job;
        $wizard->setName("Mago");
        $manager->persist($wizard);

        $monk = new Job;
        $monk->setName("Monge");
        $manager->persist($monk);

        $paladin = new Job;
        $paladin->setName("Paladino");
        $manager->persist($paladin);

        $ranger = new Job;
        $ranger->setName("Patrulheiro");
        $manager->persist($ranger);

        $manager->flush();

        $this->addReference("barbarian", $barbarian);
        $this->addReference("bard", $bard);
        $this->addReference("warlock", $warlock);
        $this->addReference("cleric", $cleric);
        $this->addReference("druid", $druid);
        $this->addReference("sorcerer", $sorcerer);
        $this->addReference("fighter", $fighter);
        $this->addReference("rogue", $rogue);
        $this->addReference("wizard", $wizard);
        $this->addReference("monk", $monk);
        $this->addReference("paladin", $paladin);
        $this->addReference("ranger", $ranger);
    }

    public function getOrder()
    {
        return 2;
    }
}
