-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
error:
Doctrine\ORM\QueryBuilder::setParameters(): Argument 1 ($parameters) must be of type Doctrine\Common\Collections\ArrayCollection, array given, called in /var/www/symfony/vendor/anyx/login-gate-bundle/Entity/FailureLoginAttemptRepository.php on line 17
We need fix setParameters type.
<?php
namespace Anyx\LoginGateBundle\Entity;
use Anyx\LoginGateBundle\Model;
use Anyx\LoginGateBundle\Model\FailureLoginAttemptRepositoryInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityRepository as Repository;
class FailureLoginAttemptRepository extends Repository implements FailureLoginAttemptRepositoryInterface
{
public function getCountAttempts(string $ip, ?string $username, \DateTime $startDate): int
{
$queryBuilder = $this->createQueryBuilder('attempt')
->select('COUNT(attempt.id)')
->where('attempt.ip = :ip')
->andWhere('attempt.createdAt > :createdAt')
-- ->setParameters([
++ ->setParameters(new ArrayCollection([
'ip' => $ip,
'createdAt' => $startDate,
-- ]);
++ ]));
if (!$username) {
$queryBuilder->andWhere('attempt.username IS NULL');
} else {
$queryBuilder->andWhere('attempt.username = :username')->setParameter('username', $username);
}
return $queryBuilder
->getQuery()
->getSingleScalarResult();
}Metadata
Metadata
Assignees
Labels
No labels