<commit_before><?php

namespace App\Model\Repository;

use App\Model\Entity\Match;
use Doctrine\ORM\EntityRepository;

/**
 * User repository
 */
class MatchRepository extends EntityRepository
{
    /**
     * Saves tournament to the database.
     *
     * @param Tournament
     */
    public function remove(Match $tournPlayer)
    {
        $this->_em->remove($tournPlayer);
        $this->_em->flush();
    }
    
    /**
     * Saves players tournament to the database.
     *
     * @param Tournament
     */
    public function save(Tournplayers $tournPlayer)
    {
        $this->_em->persist($tournPlayer);
        $this->_em->flush();
    }

    /**
     * Returns a collection of Matchs.
     *
     * @param integer $limit
     *   The number of users to return.
     * @param integer $offset
     *   The number of users to skip.
     * @param array $orderBy
     *   Optionally, the order by info, in the $column => $direction format.
     *
     * @return array A collection of matchs, keyed by id.
     */
    public function find($crit=array(), $limit = null, $offset = 0, $orderBy = array())
    {        
        $matchs = $this->findBy($crit, $orderBy, $limit, $offset);
        return $matchs;
    }
    
    /**
     * Returns a collection of Matchs.
     *
     * @param integer $limit
     *   The number of users to return.
     * @param integer $offset
     *   The number of users to skip.
     * @param array $orderBy
     *   Optionally, the order by info, in the $column => $direction format.
     *
     * @return array A collection of matchs
     */
    public function findNext($date, $sort, $limit) {
        $qb = $this->_em->createQueryBuilder()
                ->select('m')
                ->from('App\Model\Entity\Matchs', 'm')
                ->where('m.date > ?1')
                ->setParameter(1, $date)
                ->orderBy($sort)
                ->setMaxResults($limit)
                ;
        
        $query = $qb->getQuery();
        return $query->getResult();
    }
    
     /**
     * Returns a collection of Matchs.
     *
     * @param integer $limit
     *   The number of users to return.
     * @param integer $offset
     *   The number of users to skip.
     * @param array $orderBy
     *   Optionally, the order by info, in the $column => $direction format.
     *
     * @return array A collection of matchs
     */
    public function findPrevious($date, $sort, $limit) {
        $qb = $this->_em->createQueryBuilder()
                ->select('m')
                ->from('App\Model\Entity\Matchs', 'm')
                ->where('m.date < ?1')
                ->setParameter(1, $date)
                ->orderBy($sort)
                ->setMaxResults($limit)
                ;
        
        $query = $qb->getQuery();
        return $query->getResult();
    }
}<commit_msg>Bug fix for last matchs<commit_after><?php

namespace App\Model\Repository;

use App\Model\Entity\Match;
use Doctrine\ORM\EntityRepository;

/**
 * User repository
 */
class MatchRepository extends EntityRepository
{
    /**
     * Saves tournament to the database.
     *
     * @param Tournament
     */
    public function remove(Match $tournPlayer)
    {
        $this->_em->remove($tournPlayer);
        $this->_em->flush();
    }
    
    /**
     * Saves players tournament to the database.
     *
     * @param Tournament
     */
    public function save(Tournplayers $tournPlayer)
    {
        $this->_em->persist($tournPlayer);
        $this->_em->flush();
    }

    /**
     * Returns a collection of Matchs.
     *
     * @param integer $limit
     *   The number of users to return.
     * @param integer $offset
     *   The number of users to skip.
     * @param array $orderBy
     *   Optionally, the order by info, in the $column => $direction format.
     *
     * @return array A collection of matchs, keyed by id.
     */
    public function find($crit=array(), $limit = null, $offset = 0, $orderBy = array())
    {        
        $matchs = $this->findBy($crit, $orderBy, $limit, $offset);
        return $matchs;
    }
    
    /**
     * Returns a collection of Matchs.
     *
     * @param integer $limit
     *   The number of users to return.
     * @param integer $offset
     *   The number of users to skip.
     * @param array $orderBy
     *   Optionally, the order by info, in the $column => $direction format.
     *
     * @return array A collection of matchs
     */
    public function findNext($date, $sort, $limit) {
        $qb = $this->_em->createQueryBuilder()
                ->select('m')
                ->from('App\Model\Entity\Matchs', 'm')
                ->where('m.date > ?1')
                ->setParameter(1, $date)
                ->orderBy($sort)
                ->setMaxResults($limit)
                ;
        
        $query = $qb->getQuery();
        return $query->getResult();
    }
    
     /**
     * Returns a collection of Matchs.
     *
     * @param integer $limit
     *   The number of users to return.
     * @param integer $offset
     *   The number of users to skip.
     * @param array $orderBy
     *   Optionally, the order by info, in the $column => $direction format.
     *
     * @return array A collection of matchs
     */
    public function findPrevious($date, $sort, $limit) {
        $qb = $this->_em->createQueryBuilder()
                ->select('m')
                ->from('App\Model\Entity\Matchs', 'm')
                ->where('m.date < ?1')
                ->setParameter(1, $date)
                ->orderBy($sort, "DESC")
                ->setMaxResults($limit)
                ;
        
        $query = $qb->getQuery();
        return $query->getResult();
    }
}
{'fraction_non_alphanumeric': 0.13126533473536628, 'fraction_numerical': 0.0017525411847178409, 'mean_word_length': 1.7516875602700097, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 69, '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': '4541087', 'n_tokens_mistral': 1698, 'n_tokens_neox': 1651, 'n_words': 455}