<commit_before><?php
/**
 * Created by PhpStorm.
 * User: loic
 * Date: 22/12/2015
 * Time: 13:13
 */

namespace AppBundle\Command;

use Doctrine\ORM\EntityRepository;
use JDJ\LudographieBundle\Entity\Personne;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;


/**
 * @author <NAME> <<EMAIL>>
 */
class LoadPersonsCommand extends LoadCommand
{
    protected $writeEntityInOutput = false;

    /**
     * @inheritdoc
     */
    protected function configure()
    {
        $this
            ->setName('app:persons:load')
            ->setDescription('Load persons');
    }

    public function getRows()
    {
        $query = <<<EOM
select      old.id,
            case
                when old.nom_famille = '' then old.nom
                else old.nom_famille
            end as nom,
            old.prenom as prenom,
            old.siteweb as siteWeb,
            old.description as description,
            country.id as pays_id
from        jedisjeux.jdj_personnes old
left join   jdj_pays country
                on CONVERT(country.libelle USING utf8) = CONVERT(old.nationnalite USING utf8)
where       old.id <>14
and         (old.nom_famille <> '' or old.nom <> '')
EOM;

        return $this->getDatabaseConnection()->fetchAll($query);
    }

    /**
     * @inheritdoc
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $output->writeln("<comment>Load persons</comment>");

        parent::execute($input, $output);
    }

    public function createEntityNewInstance()
    {
        return new Personne();
    }

    public function getRepository()
    {
        return $this->getEntityManager()->getRepository('JDJLudographieBundle:Personne');
    }

    public function getTableName()
    {
        return "jdj_personne";
    }
}<commit_msg>adding country data on loading persons command<commit_after><?php
/**
 * Created by PhpStorm.
 * User: loic
 * Date: 22/12/2015
 * Time: 13:13
 */

namespace AppBundle\Command;

use Doctrine\ORM\EntityRepository;
use JDJ\LudographieBundle\Entity\Personne;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;


/**
 * @author <NAME> <<EMAIL>>
 */
class LoadPersonsCommand extends LoadCommand
{
    protected $writeEntityInOutput = false;

    /**
     * @inheritdoc
     */
    protected function configure()
    {
        $this
            ->setName('app:persons:load')
            ->setDescription('Load persons');
    }

    public function getRows()
    {
        $query = <<<EOM
select      old.id,
            case
                when old.nom_famille = '' then old.nom
                else old.nom_famille
            end as nom,
            old.prenom as prenom,
            old.siteweb as siteWeb,
            old.description as description,
            country.id as country_id
from        jedisjeux.jdj_personnes old
left join   jdj_country country
                on CONVERT(country.name USING utf8) = CONVERT(old.nationnalite USING utf8)
where       old.id <>14
and         (old.nom_famille <> '' or old.nom <> '')
order by    old.id
EOM;

        return $this->getDatabaseConnection()->fetchAll($query);
    }

    /**
     * @inheritdoc
     */
    public function filterData(array $data)
    {
        $data['country'] = !empty($data['country_id']) ? $this
            ->getEntityManager()
            ->getRepository('AppBundle:Country')
            ->findOneBy(array('id' => $data['country_id'])) : null;

        return parent::filterData($data);
    }

    /**
     * @inheritdoc
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $output->writeln("<comment>Load persons</comment>");

        parent::execute($input, $output);
    }

    public function createEntityNewInstance()
    {
        return new Personne();
    }

    public function getRepository()
    {
        return $this->getEntityManager()->getRepository('JDJLudographieBundle:Personne');
    }

    public function getTableName()
    {
        return "jdj_personne";
    }
}
{'fraction_non_alphanumeric': 0.11853088480801335, 'fraction_numerical': 0.0076317672310994514, 'mean_word_length': 2.3049645390070923, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 39, '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': '7140607', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1219, 'n_words': 264}