/** * Render postcard * * @param Post $post * @param $locale * @return Response * @ParamConverter("post", * class="RainlikeBlogBundle:Post", * options={"id" = "id"} * ) * @Method("GET") */ public function renderPostcardAction(Post $post, $locale) { $cLanguage = $this->get('like_container')->currentLanguage(); $transPost = $post->getCurrentTransPost($cLanguage); $otherTransPosts = $post->getOtherTransPosts($cLanguage); return $this->render('@RainlikeBlog/post/postcard.html.twig', ['post' => $post, 'transPost' => $transPost, 'otherTransPosts' => $otherTransPosts, 'locale' => $locale]); }
public function load(ObjectManager $manager) { foreach ($this->posts as $post) { $entity = new Post(); $entity->setMarker($post['marker']); $entity->setNote($post['note']); $entity->setCreated(new \DateTime()); $entity->setEnabled(true); $entity->setHasTranslate(true); $entity->setCategory($manager->merge($this->getReference('category-' . strtolower($post['category'])))); foreach ($post['tags'] as $tag) { $entity->addTag($manager->merge($this->getReference('tag-' . strtolower($tag)))); } $manager->persist($entity); $this->addReference('post-' . strtolower($post['slug']), $entity); } $manager->flush(); }