public function loadData($name) {

        $file = sprintf('%s/../Resources/fixtures/%s.yml', __DIR__ , $name);
        if(!file_exists($file)) {
            throw new \Exception(sprintf('fixtures file "%s" not found for name "%s"', $file, $name));
        }

        $data = Yaml::parse($file);

        $items = [];
        foreach ($data as $args) {
            $item = $this->create($args);
            $this->manager->persist($item);
            $items[] = $item;
        }

        $this->manager->flush();
    }
public function loadData($name) {

        $file = sprintf('%s/../Resources/fixtures/%s.yml', __DIR__ , $name);
        if(!file_exists($file)) {
            throw new \Exception(sprintf('fixtures file "%s" not found for name "%s"', $file, $name));
        }

        $data = Yaml::parse($file);

        $items = [];
        foreach ($data as $args) {
            $item = $this->create($args);
            $this->manager->persist($item);
            $items[] = $item;
        }

        $this->manager->flush();
    }
public function loadData ( $ name ) { $ file = sprintf ( '%s/../Resources/fixtures/%s.yml' , __DIR__ , $ name ) ; if ( ! file_exists ( $ file ) ) { throw new \ Exception ( sprintf ( 'fixtures file "%s" not found for name "%s"' , $ file , $ name ) ) ; } $ data = Yaml :: parse ( $ file ) ; $ items = [ ] ; foreach ( $ data as $ args ) { $ item = $ this -> create ( $ args ) ; $ this -> manager -> persist ( $ item ) ; $ items [ ] = $ item ; } $ this -> manager -> flush ( ) ; }
Load the data from fixture file and insert it into the database

@param $name
@throws \Exception
Load the data from fixture file and insert it into the database