예제 #1
0
 /**
  * {@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);
 }
예제 #2
0
 /**
  * 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;
 }