Exemplo n.º 1
0
 public function testAction($some)
 {
     return $this->render('UserActionBundle:User:recentList.html.twig', array('articles' => $articles));
     //*
     $user = $this->getDoctrine()->getRepository('UserActionBundle:User')->find($some);
     //var_dump($user);exit;
     $categoryName = $user->getUserLogin()->getLogin();
     var_dump($categoryName);
     exit;
     //*/
     $userLogin = new UserLogin();
     $userLogin->setLogin($some);
     $userLogin->setPassword('gello');
     $userLogin->setHash('hello');
     $userLogin->setConfirmationCode('hello');
     $user = new User();
     $user->setName($some);
     // Связывает этот продукт с категорией
     $user->setUserLogin($userLogin);
     // add suer
     $userLogin->setUser($user);
     $em = $this->getDoctrine()->getEntityManager();
     $em->persist($userLogin);
     $em->persist($user);
     $em->flush();
     return new Response('Created $user id: ' . $user->getId() . ' and $userLogin id: ' . $userLogin->getId());
     //return $this->render('UserActionBundle:Default:index.html.twig', array('name' => $some));
 }