<commit_before><?php

namespace Dashboard\AssignmentBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Dashboard\AssignmentBundle\Entity\Assignment;
use Dashboard\AssignmentBundle\Entity\Course;
use Dashboard\AssignmentBundle\Entity\Faculty;
use Symfony\Component\httpFoundation\Request;
use Dashboard\AssignmentBundle\Form\Type\AssignmentType;
use Dashboard\AssignmentBundle\Form\Type\CourseType;


	/**
*@Route("/Assignment")
*/

class DefaultController extends Controller
{
    /**
     * @Route("/index", name="AssignmentIndex")
     * @Template()
     */
    public function indexAction() {
        $em = $this->getDoctrine()->getManager();
        $assignments = $em->getRepository('DashboardAssignmentBundle:Assignment')->findAll();
        return array('assignments' => $assignments);
    } 
	   	/**
        * @Route("/newObject")
        * @Template()
        */
	public function NewObject(){
				
		$course = new Course();
		$course -> setName('NIV200');
		$em = $this->getDoctrine()->getManager();
                $em->persist($course);
		
		$faculty = new Faculty();
		$faculty -> setfirstName('Song');
		$faculty -> setlastName('Chen');
		//$faculty -> setEmail('<EMAIL>');
		//$faculty -> setTitle('p');
		//$faculty -> setDepartment('East Asian');

        //$em->persist($faculty);
        $em->flush();
		return; 
		
		}
   	/**
        * @Route("/new", name="newAssignment")
        * @Template()
        */
	public function newAction(Request $request)
	{
		// create a Assignment and give it some dummy data for this example
		$assignment = new Assignment();
		
		//$assignment->setStudentsEnrolled(0);
		
		$form = $this ->createForm(new AssignmentType(), $assignment);//$this->createFormBuilder($assignment)
		//->getForm();
			
		$form->handleRequest($request);
		
		if ($form->isValid()){
                        $em = $this->getDoctrine()->getManager();
                        $em->persist($assignment);
                        $em->flush();
			return $this->redirect($this->generateUrl('AssignmentIndex'));
			}
			
		return $this->render('DashboardAssignmentBundle:Default:new.html.twig', array(
            'form' => $form->createView(),
                   ));
		}
		
		   	/**
        * @Route("/newCourse", name="newCourse")
        * @Template()
        */
	public function newCourseAction(Request $request)
	{

		$course = new Course();
			
		$form = $this ->createForm(new CourseType(), $course);
			
		$form->handleRequest($request);
		
		if ($form->isValid()){
                        $em = $this->getDoctrine()->getManager();
                        $em->persist($course);
                        $em->flush();
			return $this->redirect($this->generateUrl('AssignmentIndex'));
			}
			
		return $this->render('DashboardAssignmentBundle:Default:new.html.twig', array(
            'form' => $form->createView(),
                   ));
		}
}



<commit_msg>Add a comment in controller<commit_after><?php

namespace Dashboard\AssignmentBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Dashboard\AssignmentBundle\Entity\Assignment;
use Dashboard\AssignmentBundle\Entity\Course;
use Dashboard\AssignmentBundle\Entity\Faculty;
use Symfony\Component\httpFoundation\Request;
use Dashboard\AssignmentBundle\Form\Type\AssignmentType;
use Dashboard\AssignmentBundle\Form\Type\CourseType;


	/**
*@Route("/Assignment")
*/

class DefaultController extends Controller
{
    /**
     * @Route("/index", name="AssignmentIndex")
     * @Template()
     */
    public function indexAction() {
        $em = $this->getDoctrine()->getManager();
        $assignments = $em->getRepository('DashboardAssignmentBundle:Assignment')->findAll();
        return array('assignments' => $assignments);
    } 
	   	/**
        * @Route("/newObject")
        * @Template()
        */
	public function NewObject(){
				
		$course = new Course();
		$course -> setName('NIV200');
		$em = $this->getDoctrine()->getManager();
                $em->persist($course);
		
		$faculty = new Faculty();
		$faculty -> setfirstName('Song');
		$faculty -> setlastName('Chen');
		//$faculty -> setEmail('<EMAIL>');
		//$faculty -> setTitle('p');
		//$faculty -> setDepartment('East Asian');

        //$em->persist($faculty);
        $em->flush();
		return; 
		
		}
   	/**
        * @Route("/new", name="newAssignment")
        * @Template()
        */
	public function newAction(Request $request)
	{
		// create a Assignment and give it some dummy data for this example
		$assignment = new Assignment();
		
		//$assignment->setStudentsEnrolled(0);
		
		$form = $this ->createForm(new AssignmentType(), $assignment);//$this->createFormBuilder($assignment)
		//->getForm();
			
		$form->handleRequest($request);
		
		if ($form->isValid()){
                        $em = $this->getDoctrine()->getManager();
                        $em->persist($assignment);
                        $em->flush();
			return $this->redirect($this->generateUrl('AssignmentIndex'));
			}
			
		return $this->render('DashboardAssignmentBundle:Default:new.html.twig', array(
            'form' => $form->createView(),
                   ));
		}
		
		   	/**
        * @Route("/newCourse", name="newCourse")
        * @Template()
        */
	public function newCourseAction(Request $request)
	{

		$course = new Course();
			
		$form = $this ->createForm(new CourseType(), $course);
			
		$form->handleRequest($request);
		
		if ($form->isValid()){
                        $em = $this->getDoctrine()->getManager();
                        $em->persist($course);
                        $em->flush();
			return $this->redirect($this->generateUrl('AssignmentIndex'));//need to add a CourseIndex function
			}
			
		return $this->render('DashboardAssignmentBundle:Default:new.html.twig', array(
            'form' => $form->createView(),
                   ));
		}
}




{'fraction_non_alphanumeric': 0.16480357713190674, 'fraction_numerical': 0.0012775471095496647, 'mean_word_length': 2.828239608801956, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 91, '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': '4332221', 'n_tokens_mistral': 1951, 'n_tokens_neox': 1785, 'n_words': 295}