Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
namespace Plugin\CustomerLogin\Repository;
use Eccube\Repository\CustomerRepository as BaseRepository;
use Eccube\Entity\Master\CustomerStatus;
use Eccube\Common\Constant;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
class CustomerRepository extends BaseRepository
public function loadUserByUsername($username)
// 本会員ステータスの会員のみ有効.
$CustomerStatus = $this
$query = $this->createQueryBuilder('c')
->where(' = :email')
->orWhere(' = :id')
->andWhere('c.del_flg = :delFlg')
->andWhere('c.Status =:CustomerStatus')
'email' => $username,
'id' => $username,
'delFlg' => Constant::DISABLED,
'CustomerStatus' => $CustomerStatus,
$Customer = $query->getOneOrNullResult();
if (!$Customer) {
throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username));
return $Customer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment