public function createAction(Request $request)
{
$entity = new AdminPost();
$entity->setCurrentLocale($request->getDefaultLocale());
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$entity->setSlug($entity->getTranslationByLocale($request->getDefaultLocale())->getTitle());
$em->persist($entity);
$em->flush();
$this->successFlashBag('successful.create');
return $this->redirectToRoute('ojs_admin_post_show', ['id' => $entity->getId()]);
}
return $this->render('OjsAdminBundle:AdminPost:new.html.twig', ['entity' => $entity, 'form' => $form->createView()]);
}