<commit_before><?php

namespace Yoda\UserBundle\Repository;

/**
 * UserRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class UserRepository extends \Doctrine\ORM\EntityRepository
{
}<commit_msg>02_13-Doctrines QueryBuilder: first steps for using the username or email for the log in<commit_after><?php

namespace Yoda\UserBundle\Repository;

/**
 * UserRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class UserRepository extends \Doctrine\ORM\EntityRepository
{
  /**
   * @param $username
   * @return User/null
   */
  public function findOneByUsernameOrEamil($username) {
    return $this->createQueryBuilder('u')
        ->andWhere('u.username = :username OR u.email = :email')
        ->setParameter('username', $username)
        ->setParameter('email', $username)
        ->getQuery()
        ->getOneOrNullResult();
  }
}
{'fraction_non_alphanumeric': 0.11375387797311272, 'fraction_numerical': 0.004136504653567736, 'mean_word_length': 3.7219512195121953, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7551723', 'n_tokens_mistral': 274, 'n_tokens_neox': 273, 'n_words': 79}