<commit_before><?php

namespace MobileSplash\SplashRequestBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use MobileSplash\SplashRequestBundle\Entity\SplashDetails;
use MobileSplash\SplashRequestBundle\Form\Type\SplashRequestType;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\HttpFoundation\Response;

class SplashRequestController extends Controller
{
    public function indexAction()
    {

    }
    public function addAction(Request $request)
    {
         $em = $this->getDoctrine()->getManager();
         $splashDetails = new SplashDetails();
         $RequestForm = $this->addRequestForm($splashDetails);
         $RequestForm->handleRequest($request);
        if ($RequestForm->isValid()) 
           {
            $em->persist($splashDetails);
            $em->flush();
            $this->get('session')->getFlashBag()->add('success','Your Request Saved Succesfully!');
            return $this->redirectToRoute('mobile_splash_request_add');
           }

        return $this->render('MobileSplashSplashRequestBundle:SplashRequest:splash_request_form.html.twig', [
        'entity' => $splashDetails,
        'RequestForm' => $RequestForm->createView(),
         ]);
    }
    
    public function requestListAction() 
    {
                $em = $this->getDoctrine()->getEntityManager();
                $request_list = $em->getRepository('MobileSplashSplashRequestBundle:SplashDetails')->findAll();
                return $this->render('MobileSplashSplashRequestBundle:SplashRequest:splash_requests.html.twig',array('request_list'=>$request_list));

    }
    
    public function requestDetailsAction($id)
    {
          $em = $this->getDoctrine()->getManager();
          $requestdetails = $em->getRepository('MobileSplashSplashRequestBundle:SplashDetails')
            ->find($id);

           $serializer = new Serializer(array(new GetSetMethodNormalizer()), array('json' => new 
            JsonEncoder()));
            $json = $serializer->serialize($requestdetails, 'json');
            return $this->render('MobileSplashSplashRequestBundle:SplashRequest:splash_request_details.html.twig', array('requestdetails'=>$requestdetails));

    }
    
    public function getVendorsAction($country_id){
     
          
           $em = $this->getDoctrine()->getManager();
           $vendors = $em->getRepository('MobileSplashSplashRequestBundle:Vendors')
            ->findVendorsByCountry($country_id);
           $serializer = new Serializer(array(new GetSetMethodNormalizer()), array('json' => new 
            JsonEncoder()));
            $json = $serializer->serialize($vendors, 'json');
            return new Response($json);
 
 
    }
    public function addRequestForm(SplashDetails $splashDetails) {
        
        $em = $this->getDoctrine()->getEntityManager();
        $form=$this->createForm(new SplashRequestType($em),$splashDetails);
        return $form;
    }
}<commit_msg>Removing deprecated getEntityManager() occurances.<commit_after><?php

namespace MobileSplash\SplashRequestBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use MobileSplash\SplashRequestBundle\Entity\SplashDetails;
use MobileSplash\SplashRequestBundle\Form\Type\SplashRequestType;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\HttpFoundation\Response;

class SplashRequestController extends Controller
{
    public function indexAction()
    {

    }
    public function addAction(Request $request)
    {
         $em = $this->getDoctrine()->getManager();
         $splashDetails = new SplashDetails();
         $RequestForm = $this->addRequestForm($splashDetails);
         $RequestForm->handleRequest($request);
        if ($RequestForm->isValid()) 
           {
            $em->persist($splashDetails);
            $em->flush();
            $this->get('session')->getFlashBag()->add('success','Your Request Saved Succesfully!');
            return $this->redirectToRoute('mobile_splash_request_add');
           }

        return $this->render('MobileSplashSplashRequestBundle:SplashRequest:splash_request_form.html.twig', [
        'entity' => $splashDetails,
        'RequestForm' => $RequestForm->createView(),
         ]);
    }
    
    public function requestListAction() 
    {
                $em = $this->getDoctrine()->getManager();
                $request_list = $em->getRepository('MobileSplashSplashRequestBundle:SplashDetails')->findAll();
                return $this->render('MobileSplashSplashRequestBundle:SplashRequest:splash_requests.html.twig',array('request_list'=>$request_list));

    }
    
    public function requestDetailsAction($id)
    {
          $em = $this->getDoctrine()->getManager();
          $requestdetails = $em->getRepository('MobileSplashSplashRequestBundle:SplashDetails')
            ->find($id);

           $serializer = new Serializer(array(new GetSetMethodNormalizer()), array('json' => new 
            JsonEncoder()));
            $json = $serializer->serialize($requestdetails, 'json');
            return $this->render('MobileSplashSplashRequestBundle:SplashRequest:splash_request_details.html.twig', array('requestdetails'=>$requestdetails));

    }
    
    public function getVendorsAction($country_id){
     
          
           $em = $this->getDoctrine()->getManager();
           $vendors = $em->getRepository('MobileSplashSplashRequestBundle:Vendors')
            ->findVendorsByCountry($country_id);
           $serializer = new Serializer(array(new GetSetMethodNormalizer()), array('json' => new 
            JsonEncoder()));
            $json = $serializer->serialize($vendors, 'json');
            return new Response($json);
 
 
    }
    public function addRequestForm(SplashDetails $splashDetails) {
        
        $em = $this->getDoctrine()->getManager();
        $form=$this->createForm(new SplashRequestType($em),$splashDetails);
        return $form;
    }
}
{'fraction_non_alphanumeric': 0.1290373906125696, 'fraction_numerical': 0.0, 'mean_word_length': 3.368311327310632, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '984774', 'n_tokens_mistral': 1768, 'n_tokens_neox': 1677, 'n_words': 233}