Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getAction($id) {
- $em = $this->getDoctrine()->getManager();
- $achievement = $em->getRepository('BlogBundle:Achievements')->find($id);
- $achievementid = $achievement->getId();
- $user = $this->getUser()->getId();
- $userpoint = $this->getUser()->getpoints();
- $userid = $this->getUser()->getId();
- $points = $achievement->getpoints();
- if($userpoint >= $points) {
- $category = $this->getUser();
- $product = $em->getRepository('BlogBundle:Achievements')->find($id);
- // relate this product to the category
- // Pobiera achievements
- $product->getId();
- // Pobiera użytkownika
- $category->getId();
- $em = $this->getDoctrine()->getManager();
- $em->persist($product);
- $em->persist($category);
- $em->flush();
- return new Response(
- 'Saved new product with id: '.$product->getId()
- .' and new category with id: '.$category->getId()
- );
- }
- return $this->render('BlogBundle:Achievements:get.html.twig', array(
- 'pokaz' => $userpoint
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement