UserRepository::findOneByEmail()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
nc 1
cc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of AppName.
5
 *
6
 * (c) Monofony
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Repository;
13
14
use Sylius\Bundle\UserBundle\Doctrine\ORM\UserRepository as BaseUserRepository;
15
use Sylius\Component\User\Model\UserInterface;
16
use Sylius\Component\User\Repository\UserRepositoryInterface;
17
18
class UserRepository extends BaseUserRepository implements UserRepositoryInterface
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function findOneByEmail(string $email): ?UserInterface
24
    {
25
        return $this->createQueryBuilder('o')
26
            ->innerJoin('o.customer', 'customer')
27
            ->andWhere('customer.emailCanonical = :email')
28
            ->setParameter('email', $email)
29
            ->getQuery()
30
            ->getOneOrNullResult()
31
        ;
32
    }
33
}
34