Elcodi\Fixtures\DataFixtures\ORM\Zone\ZoneData::load PHP Method

load() public method

Load data fixtures with the passed EntityManager
public load ( Doctrine\Common\Persistence\ObjectManager $manager )
$manager Doctrine\Common\Persistence\ObjectManager
    public function load(ObjectManager $manager)
    {
        /**
         * @var ObjectDirector $zoneDirector
         */
        $zones = $this->parseYaml(dirname(__FILE__) . '/zones.yml');
        $zoneDirector = $this->getDirector('zone');
        $zoneCollection = new ArrayCollection();
        foreach ($zones as $zoneName => $locations) {
            $zoneCode = strtolower(trim(preg_replace('~[^a-zA-Z\\d]{1}~', '', $zoneName)));
            $zone = $zoneDirector->create()->setName($zoneName)->setCode($zoneCode)->setLocations($locations);
            $zoneCollection->add($zone);
            $this->setReference('zone-' . $zoneCode, $zone);
            $zoneDirector->save($zone);
        }
        $this->setReference('zone-collection', $zoneCollection);
    }
ZoneData