Ejemplo n.º 1
0
 public function load(ObjectManager $manager)
 {
     $filePath = $this->container->get('kernel')->locateResource('@NetworkStoreBundle/Resources/DataFixtures/posts');
     $posts = array_map('trim', explode("\n", file_get_contents($filePath)));
     $id = 0;
     foreach ($posts as $postName) {
         $post = new JobPost();
         $post->setId($id++)->setName($postName)->setPredefined(true);
         $manager->persist($post);
     }
     $manager->flush();
 }