/** * {@inheritDoc} */ public function load(ObjectManager $manager) { $image = new Image(); $image->setName('Default avatar'); $image->setPath('default_avatar.png'); $this->get('teapotio.image')->save($image); $this->addReference('image-default-avatar', $image); }
/** * Save an Image object|entity * * @param Image $image * * @return Image */ public function save(Image $image) { // Very important $image->setRootPath($this->rootDir); $this->em->persist($image); $this->em->flush(); return $image; }