/** * @Given /^there are the following classrooms:$/ */ public function thereAreTheFollowingClassrooms(TableNode $table) { $em = $this->kernel->getContainer()->get('doctrine')->getManager(); foreach ($table->getHash() as $hash) { $classroom = new Entity\Classroom(); $classroom->setName($hash['name']); $classroom->setTeacher($this->findTeacherEntity($hash['teacher'])); $em->persist($classroom); $em->flush(); } }