UserRepository   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A findOneByEmail() 0 10 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