<commit_before><?php

namespace Project\AppBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * PromotionRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class PromotionRepository extends EntityRepository
{
    /**
     * Create a json of a promotion.
     *
     * @param int $promotion id of the promotion to convert to a json.
     * @return string JSON that contain the element of a promotion.
     */
    public function toJson($promotion)
    {
        $qb = $this->createQueryBuilder('p');

        $qb->where('p.id = :id')
            ->setParameter('id', $promotion)
            ->andWhere('p.archive IS NULL')
            ->setMaxResults(1);

        $promotion = $qb->getQuery()
            ->getSingleResult();

        $jsonData = array(
                          'promotion' => $promotion->__toString(),
                          'formation' => $promotion->getFormation()->__toString(),
                          'start'     => $promotion->getStartDate()->format('Y-m-d H:i:s'),
                          'end'       => $promotion->getEndDate()->format('Y-m-d H:i:s')
                          );

        return json_encode($jsonData);
    }
}<commit_msg>Include data in an array in Promotion archive method<commit_after><?php

namespace Project\AppBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * PromotionRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class PromotionRepository extends EntityRepository
{
    /**
     * Create a json of a promotion.
     *
     * @param int $promotion id of the promotion to convert to a json.
     * @return string JSON that contain the element of a promotion.
     */
    public function toJson($promotion)
    {
        $jsonDate = array();

        $qb = $this->createQueryBuilder('p');

        $qb->where('p.id = :id')
            ->setParameter('id', $promotion)
            ->andWhere('p.archive IS NULL')
            ->setMaxResults(1);

        $promotion = $qb->getQuery()
            ->getSingleResult();

        $jsonData[] = array(
                            'promotion' => $promotion->__toString(),
                            'formation' => $promotion->getFormation()->__toString(),
                            'start'     => $promotion->getStartDate()->format('Y-m-d H:i:s'),
                            'end'       => $promotion->getEndDate()->format('Y-m-d H:i:s')
                            );

        return json_encode($jsonData);
    }
}
{'fraction_non_alphanumeric': 0.13361901051811453, 'fraction_numerical': 0.0007791195948578107, 'mean_word_length': 1.9415807560137457, 'pattern_counts': {'":': 0, '<': 5, '<?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': '8507', 'n_tokens_mistral': 712, 'n_tokens_neox': 705, 'n_words': 176}