Ejemplo n.º 1
0
 /**
  * Translate Sample data by current Language for self page
  *
  * @return Response
  *
  * @param $id
  * @param $locale
  * @param Sample $sample
  * @ParamConverter("sample",
  *                  class="SonetAppBundle:Sample",
  *                  options={"id" = "id"}
  * )
  * @Method("GET")
  */
 public function translateDataAction($id, $locale, Sample $sample)
 {
     $cLocale = $this->get('like_container')->currentLocale();
     $cLanguage = $this->get('entity')->languages()->getLanguageByLocale($locale);
     $defLocale = $this->container->getParameter('locale');
     $defLanguage = $this->get('entity')->languages()->getLanguageByLocale($defLocale);
     $imageDir = $this->get('image')->getSamplesDir();
     $data = $sample->getDisplayedData($cLanguage, $defLanguage);
     return $this->render("@SonetApp/Samples/translatedData.html.twig", array('currentLocale' => $cLocale, 'imageDir' => $imageDir, 'sample' => $sample, 'data' => $data));
 }
Ejemplo n.º 2
0
 public function load(ObjectManager $manager)
 {
     $sample1 = new Sample();
     $sample1->setName('Sample 01');
     $sample1->setTeaser('sample_01.png');
     $sample1->setEnabled(true);
     $manager->persist($sample1);
     $sample2 = new Sample();
     $sample2->setName('Sample 02');
     $sample2->setTeaser('sample_02.png');
     $sample2->setEnabled(true);
     $manager->persist($sample2);
     $sample3 = new Sample();
     $sample3->setName('Sample 03');
     $sample3->setTeaser('sample_03.png');
     $sample3->setEnabled(true);
     $manager->persist($sample3);
     $manager->flush();
     $this->addReference('sample-1', $sample1);
     $this->addReference('sample-2', $sample2);
 }