public function load(ObjectManager $em)
 {
     $files = Finder::create()->name('*.*')->in(__DIR__ . '/../data/files');
     $manager = $this->container->get('sonata.media.manager.media');
     $medias = [];
     foreach ($files as $pos => $file) {
         $media = new Media();
         $media->setBinaryContent($file);
         $media->setEnabled(true);
         $manager->save($media, 'gallery', 'sonata.media.provider.image');
         $medias[] = $media;
     }
     $design = new PhotoCategory();
     $design->setName('Grafika');
     $design->setSlug(Inftech::slugify('Grafika'));
     $design->setImage($medias[0]);
     $design->setGallery($em->merge($this->getReference('Gallery-1')));
     $design2 = new PhotoCategory();
     $design2->setName('Grafika2');
     $design2->setSlug(Inftech::slugify('Grafika2'));
     $design2->setImage($medias[1]);
     $design2->setGallery($em->merge($this->getReference('Gallery-1')));
     $design3 = new PhotoCategory();
     $design3->setName('Grafika4');
     $design3->setSlug(Inftech::slugify('Grafika4'));
     $design3->setImage($medias[3]);
     $design3->setGallery($em->merge($this->getReference('Gallery-1')));
     $design4 = new PhotoCategory();
     $design4->setName('Grafika3');
     $design4->setSlug(Inftech::slugify('Grafika3'));
     $design4->setImage($medias[2]);
     $design4->setGallery($em->merge($this->getReference('Gallery-1')));
     $programming = new PhotoCategory();
     $programming->setName('Programowanie');
     $programming->setSlug(Inftech::slugify('Programowanie'));
     $programming->setImage($medias[4]);
     $programming->setGallery($em->merge($this->getReference('Gallery-2')));
     $linux = new PhotoCategory();
     $linux->setName('Linux');
     $linux->setSlug(Inftech::slugify('Linux'));
     $linux->setImage($medias[5]);
     $linux->setGallery($em->merge($this->getReference('Gallery-2')));
     $em->persist($design);
     $em->persist($programming);
     $em->persist($linux);
     $em->persist($design2);
     $em->persist($design3);
     $em->persist($design4);
     $em->flush();
     $this->addReference('PhotoCategory-1', $design);
     $this->addReference('PhotoCategory-4', $design2);
     $this->addReference('PhotoCategory-6', $design3);
     $this->addReference('PhotoCategory-5', $design4);
     $this->addReference('PhotoCategory-2', $programming);
     $this->addReference('PhotoCategory-3', $linux);
 }
예제 #2
0
 public function load(ObjectManager $em)
 {
     $gallery = new Gallery();
     $gallery->setName('fotografie');
     $gallery->setSlug(Inftech::slugify($gallery->getName()));
     $gallery2 = new Gallery();
     $gallery2->setName('blog');
     $em->persist($gallery);
     $em->persist($gallery2);
     $em->flush();
     $this->addReference('Gallery-1', $gallery);
     $this->addReference('Gallery-2', $gallery2);
 }
예제 #3
0
 public function load(ObjectManager $em)
 {
     $web = new Technology();
     $web->setName("Web");
     $web->setSlug(Inftech::slugify("web"));
     $cpp = new Technology();
     $cpp->setName("cpp");
     $cpp->setSlug(Inftech::slugify("cpp"));
     $asm = new Technology();
     $asm->setName("assembler");
     $asm->setSlug(Inftech::slugify("assembler"));
     $em->persist($web);
     $em->persist($cpp);
     $em->persist($asm);
     $em->flush();
     $this->addReference("Technology-web", $web);
     $this->addReference("Technology-cpp", $cpp);
     $this->addReference("Technology-asm", $asm);
 }
예제 #4
0
 public function load(ObjectManager $em)
 {
     $design = new PostCategory();
     $design->setName('Grafika');
     $design->setSlug(Inftech::slugify('Grafika'));
     $programming = new PostCategory();
     $programming->setName('Programowanie');
     $programming->setSlug(Inftech::slugify('Programowanie'));
     $linux = new PostCategory();
     $linux->setName('Linux');
     $linux->setSlug(Inftech::slugify('Linux'));
     $cubie = new PostCategory();
     $cubie->setName('Cubieboard');
     $cubie->setSlug(Inftech::slugify('Cubieboard'));
     $em->persist($design);
     $em->persist($programming);
     $em->persist($linux);
     $em->persist($cubie);
     $em->flush();
     $this->addReference('PostCategory-design', $design);
     $this->addReference('PostCategory-programming', $programming);
     $this->addReference('PostCategory-linux', $linux);
     $this->addReference('PostCategory-cubie', $cubie);
 }
예제 #5
0
 /**
  * @ORM\PreUpdate
  */
 public function preUpdate()
 {
     // Add your code here
     $this->slug = Inftech::slugify($this->getName());
     $this->modified = new \DateTime();
 }
예제 #6
0
 /**
  * @ORM\PreUpdate
  */
 public function preUpdate()
 {
     // Add your code here
     $this->slug = Inftech::slugify($this->getName());
 }
예제 #7
0
 public function getTitleSlug()
 {
     return Inftech::slugify($this->getTitle());
 }
예제 #8
0
 /**
  * @ORM\PrePersist
  */
 public function setSlugValue()
 {
     // Add your code here
     $this->slug = Inftech::slugify($this->getName());
 }