/** * @FW\Security("is_granted('IS_AUTHENTICATED_REMEMBERED')") */ public function createAction(Request $request) { $em = $this->getDoctrine()->getManager(); $event = new Event(); $event->setUser($this->getUser()); $form = $this->createForm(new EventType(), $event); $form->handleRequest($request); if ($form->isValid()) { // $data = $form->getData(); // var_dump($data);die(); //echo $data->getTags();die(); // foreach ($event->getTags() as $t){ // var_dump($t->getName()); // } // $tagManager = $this->get('fpn_tag.tag_manager'); // // // ask the tag manager to create a Tag object // $fooTag = $tagManager->loadOrCreateTag('foo'); // // // assign the foo tag to the post // $tagManager->addTag($fooTag, $event); $em->persist($event); //$place->mergeNewTranslations(); $em->flush(); // foreach ($event->getTags() as $t){ // var_dump($t->getName()); // } return $this->redirectToRoute('user_events'); } return $this->render('KromboxMainBundle:Event:new.html.twig', array('form' => $form->createView())); }
/** * @param Event $event * @return EventWrapper */ public function wrap($event) { //$p = $this->getProvider(); //$isCurrent = $this->user == $user; return new EventWrapper(['id' => $event->getId(), 'title' => $event->getName(), 'start' => $event->getStartDate()->format('Y-m-d') . ' ' . $event->getStartTime()->format('H:i:s'), 'end' => $event->getEndDate() ? $event->getEndDate()->format('Y-m-d') . ' ' . $event->getEndTime()->format('H:i:s') : null]); }