Controller/GroupController.php
public function createAction()
    {
        $group = new Group();

        $form = $this->createForm(GroupType::class, $group);
        $form->bindRequest($this->getRequest());

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getEntityManager();
            $em->persist($group);
            $em->flush();

            $this->get('session')->getFlashBag()->set('success', 'The group has been created.');

            return $this->redirect($this->generateUrl('orkestra_group_show', array('id' => $group->getId())));

        }

        return array(
            'group' => $group,
            'form' => $form->createView()
        );
    }
public function createAction()
    {
        $group = new Group();

        $form = $this->createForm(GroupType::class, $group);
        $form->bindRequest($this->getRequest());

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getEntityManager();
            $em->persist($group);
            $em->flush();

            $this->get('session')->getFlashBag()->set('success', 'The group has been created.');

            return $this->redirect($this->generateUrl('orkestra_group_show', array('id' => $group->getId())));

        }

        return array(
            'group' => $group,
            'form' => $form->createView()
        );
    }
Creates a new Group entity.

@Route("/create", name="orkestra_group_create")
@Method("post")
@Template("OrkestraApplicationBundle:Group:new.html.twig")
@Secure(roles="ROLE_GROUP_WRITE")