<commit_before><?php

namespace Extia\Bundle\MissionBundle\Controller;

use Extia\Bundle\MissionBundle\Model\Company;
use Extia\Bundle\MissionBundle\Model\CompanyQuery;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class CompanyController extends Controller
{
    /**
     * @param Request $request
     * @param         $name
     */
//    public function listAction(Request $request, $page)
//    {
//        return $this->render('ExtiaMissionBundle:Company:list.html.twig', array ('name' => $name));
//    }

    /**
     * @param Request $request
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function newAction(Request $request)
    {
        $company = new Company();

        $form = $this->renderForm($request, $company);

        return $this->render('ExtiaMissionBundle:Company:new.html.twig', array (
            'form' => $form->createView(),
        ));
    }

    public function editAction(Request $request, $id)
    {
        $company = CompanyQuery::create()
            ->setComment(sprintf('%s l:%s', __METHOD__, __LINE__))
            ->findPk($id);

        if (empty($company)) {
            throw new NotFoundHttpException(sprintf('Any consultant found for given id, "%s" given.', $Id));
        }

        $form = $this->renderForm($request, $company);

        return $this->render('ExtiaMissionBundle:Company:edit.html.twig', array (
            'form' => $form->createView(),
        ));
    }

//    public function deleteAction(Request $request, $name)
//    {
//        return $this->render('ExtiaMissionBundle:Company:index.html.twig', array ('name' => $name));
//    }

    private function renderForm(Request $request, Company $company)
    {
        $form = $this->get('form.factory')->create('company', $company, array ());<commit_msg>update method for edition one company<commit_after><?php

namespace Extia\Bundle\MissionBundle\Controller;

use Extia\Bundle\MissionBundle\Model\Company;
use Extia\Bundle\MissionBundle\Model\CompanyQuery;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class CompanyController extends Controller
{
    /**
     * @param Request $request
     * @param         $name
     */
//    public function listAction(Request $request, $page)
//    {
//        return $this->render('ExtiaMissionBundle:Company:list.html.twig', array ('name' => $name));
//    }

    /**
     * @param Request $request
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function newAction(Request $request)
    {
        $company = new Company();

        $form = $this->renderForm($request, $company);

        return $this->render('ExtiaMissionBundle:Company:new.html.twig', array (
            'form' => $form->createView(),
        ));
    }

    /**
     * @param Request $request
     * @param Company $company
     *
     * @return \Symfony\Component\HttpFoundation\Response
     * @throws NotFoundHttpException
     */
    public function editAction(Request $request, Company $company)
    {
        if (empty($company)) {
            throw new NotFoundHttpException(sprintf('Any company found for given id, "%s" given.', $Id));
        }

        $form = $this->renderForm($request, $company);

        return $this->render('ExtiaMissionBundle:Company:edit.html.twig', array (
            'form' => $form->createView(),
        ));
    }

//    public function deleteAction(Request $request, $name)
//    {
//        return $this->render('ExtiaMissionBundle:Company:index.html.twig', array ('name' => $name));
//    }

    private function renderForm(Request $request, Company $company)
    {
        $form = $this->get('form.factory')->create('company', $company, array ());
{'fraction_non_alphanumeric': 0.149829441091577, 'fraction_numerical': 0.0, 'mean_word_length': 2.8543983822042467, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '7659392', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1084, 'n_words': 215}