<commit_before><?php
/**
 * Created by PhpStorm.
 * User: Spider
 * Date: 15/04/15
 * Time: 22:45
 */

namespace ESN\MembersBundle\Form;

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Repository\RepositoryFactory;
use ESN\AdministrationBundle\Entity\University;
use ESN\MembersBundle\Entity\Erasmus;
use ESN\MembersBundle\Entity\Esner;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class ESNerUpdateType extends AbstractType{
    private $em;
    private $esner;

    public function __construct(EntityManager $em, Esner $esner)
    {
        $this->em = $em;
        $this->esner = $esner;
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $dataUni = 0;
        $dataCountry = 0;
        if ($this->esner != null){
            $dataCountry = $this->esner->getMember()->getNationality();
            $dataUni = $this->esner->getMember()->getUniversity();
        }

        $choicesUni = array();
        foreach($this->em->getRepository('ESNAdministrationBundle:University')->findAll() as $university)
            $choicesUni[$university->getId()] = $university->getName();

        $choicesCountry = array();
        foreach($this->em->getRepository('ESNAdministrationBundle:Country')->findAll() as $country)
            $choicesCountry[$country->getId()] = $country->getNationality();

        $builder->add('name', 'text')
            ->add('surname','text')
            ->add('email','email')
            ->add('phone','text')
            ->add('birthday', 'date', array('widget' => 'single_text'))
            ->add('study', 'text')
            ->add('address', 'text')
            ->add('city', 'text')
            ->add('zipcode', 'number')
            ->add('id' , 'hidden', array('attr' => array( 'value' => $this->esner->getId())))
            ->add('university', 'choice' , array('choices' => $choicesUni, 'data' => $dataUni))
            ->add('country', 'choice' , array('choices' => $choicesCountry, 'data' => $dataCountry));
    }


    public function getName()
    {
        return 'update_esners';
    }
}<commit_msg>fix choice bug edit esn<commit_after><?php
/**
 * Created by PhpStorm.
 * User: Spider
 * Date: 15/04/15
 * Time: 22:45
 */

namespace ESN\MembersBundle\Form;

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Repository\RepositoryFactory;
use ESN\AdministrationBundle\Entity\University;
use ESN\MembersBundle\Entity\Erasmus;
use ESN\MembersBundle\Entity\Esner;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class ESNerUpdateType extends AbstractType{
    private $em;
    private $esner;

    public function __construct(EntityManager $em, Esner $esner)
    {
        $this->em = $em;
        $this->esner = $esner;
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $dataUni = 0;
        $dataCountry = 0;
        if ($this->esner != null){
            $dataCountry = $this->esner->getMember()->getNationality();
            $dataUni = $this->esner->getMember()->getUniversity();
        }

        $builder->add('name', 'text')
            ->add('surname','text')
            ->add('email','email')
            ->add('phone','text')
            ->add('birthday', 'date', array('widget' => 'single_text'))
            ->add('study', 'text')
            ->add('address', 'text')
            ->add('city', 'text')
            ->add('zipcode', 'number')
            ->add('id' , 'hidden', array('attr' => array( 'value' => $this->esner->getId())))
            ->add('university', 'entity' ,
                array('class' => 'ESNAdministrationBundle:University',
                    'choices' => $this->em->getRepository('ESNAdministrationBundle:University')->findAll(),
                    'data' => $dataUni)
            )
            ->add('country', 'entity' ,
                array('class' => 'ESNAdministrationBundle:Country',
                    'choices' => $this->em->getRepository('ESNAdministrationBundle:Country')->findAll(),
                    'data' => $dataCountry
                )
            );
    }


    public function getName()
    {
        return 'update_esners';
    }
}
{'fraction_non_alphanumeric': 0.16974869606448553, 'fraction_numerical': 0.005689900426742532, 'mean_word_length': 2.593696763202726, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 81, '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': '4221308', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1252, 'n_words': 224}