Ejemplo n.º 1
0
 private function createObject(ObjectManager $manager, $title, $summary, $content)
 {
     $locales = $this->container->get('locales');
     $post = new Content($locales->getLocaleActive());
     $post->setTitle($title);
     $post->setSummary($summary);
     $post->setContent($content);
     $post->setType('post');
     $post->setStatus(true);
     $post->setCategory($this->getReference('category'));
     $manager->persist($post);
     foreach ($locales->getLocales() as $locale) {
         if (!$locale['active']) {
             $translationPost = new Content($locale['code']);
             $translationPost->setTitle($locale['code'] . ' ' . $title);
             $translationPost->setSummary($locale['code'] . ' ' . $summary);
             $translationPost->setContent($locale['code'] . ' ' . $content);
             $translationPost->setType('post');
             $translationPost->setStatus(true);
             $translationPost->setCategory($this->getReference('translationcategory-' . $locale['code']));
             $translationPost->setParentMultilangue($post);
             $manager->persist($translationPost);
         }
     }
 }
Ejemplo n.º 2
0
 public function load(ObjectManager $manager)
 {
     $locales = $this->container->get('locales');
     $page = new Content($locales->getLocaleActive());
     $page->setTitle('What is a Jedi?');
     $page->setSummary('A Jedi was a Force-sensitive individual, most often a member of the Jedi Order, who studied, served, and used the mystical energies of the Force; usually, the light side of the Force');
     $page->setContent('The weapon of a Jedi was the lightsaber, a blade made of pure energy. Jedi fought for peace and justice in the Galactic Republic, usually against their mortal enemy: the Sith, who studied the dark side of the Force. The Jedi were all but destroyed by the Sith during and after the execution of Order 66, leaving very few Jedi survivors until there was only one known living Jedi, Luke Skywalker, at the end of the Galactic Civil War.');
     $page->setType('page');
     $page->setStatus(true);
     $manager->persist($page);
     foreach ($locales->getLocales() as $locale) {
         if (!$locale['active']) {
             $translationPage = new Content($locale['code']);
             $translationPage->setTitle($locale['code'] . ' What is a Jedy?');
             $translationPage->setSummary($locale['code'] . ' A Jedi was a Force-sensitive individual, most often a member of the Jedi Order, who studied, served, and used the mystical energies of the Force; usually, the light side of the Force');
             $translationPage->setContent($locale['code'] . ' The weapon of a Jedi was the lightsaber, a blade made of pure energy. Jedi fought for peace and justice in the Galactic Republic, usually against their mortal enemy: the Sith, who studied the dark side of the Force. The Jedi were all but destroyed by the Sith during and after the execution of Order 66, leaving very few Jedi survivors until there was only one known living Jedi, Luke Skywalker, at the end of the Galactic Civil War.');
             $translationPage->setType('page');
             $translationPage->setStatus(true);
             $translationPage->setParentMultilangue($page);
             $manager->persist($translationPage);
         }
     }
     $manager->flush();
 }