public function load(ObjectManager $manager) { foreach ($this->fixtures as $file) { /** @var SplFileInfo $file */ $fixture = json_decode($file->getContents()); $tool = new Tool(); $tool->setIdentifier($fixture->identifier); $tool->setName($fixture->name); $tool->setImage($fixture->image); $tool->setNotify($fixture->notify); $tool->setDescription($fixture->description); /** @var Project $project */ $project = $this->getReference('project-' . $fixture->project); $tool->setProject($project); $manager->persist($tool); } $manager->flush(); }