Revert "Fixed errors that query builder setParameters now expects an ArrayCollection instead of an array"

This reverts commit 78671b0bfe.
This commit is contained in:
Jan Böhmer 2024-06-10 00:04:22 +02:00
parent afb816cc41
commit 5eb29746af
2 changed files with 10 additions and 12 deletions

View file

@ -30,7 +30,6 @@ use App\Entity\LogSystem\ElementDeletedLogEntry;
use App\Entity\LogSystem\ElementEditedLogEntry;
use App\Entity\LogSystem\LogTargetType;
use App\Entity\UserSystem\User;
use Doctrine\Common\Collections\ArrayCollection;
use RuntimeException;
/**
@ -86,10 +85,10 @@ class LogEntryRepository extends DBElementRepository
->orderBy('log.timestamp', 'DESC')
->setMaxResults(1);
$qb->setParameters(new ArrayCollection([
$qb->setParameters([
'target_type' => LogTargetType::fromElementClass($class),
'target_id' => $id,
]));
]);
$query = $qb->getQuery();
@ -122,11 +121,11 @@ class LogEntryRepository extends DBElementRepository
->andWhere('log.timestamp >= :until')
->orderBy('log.timestamp', 'DESC');
$qb->setParameters(new ArrayCollection([
$qb->setParameters([
'target_type' => LogTargetType::fromElementClass($element),
'target_id' => $element->getID(),
'until' => $until,
]));
]);
$query = $qb->getQuery();
@ -148,11 +147,11 @@ class LogEntryRepository extends DBElementRepository
->andWhere('log.timestamp >= :until')
->orderBy('log.timestamp', 'DESC');
$qb->setParameters(new ArrayCollection([
$qb->setParameters([
'target_type' => LogTargetType::fromElementClass($element),
'target_id' => $element->getID(),
'until' => $timestamp,
]));
]);
$query = $qb->getQuery();
$count = $query->getSingleScalarResult();
@ -233,10 +232,10 @@ class LogEntryRepository extends DBElementRepository
->andWhere('log.target_id = :target_id')
->orderBy('log.timestamp', 'DESC');
$qb->setParameters(new ArrayCollection([
$qb->setParameters([
'target_type' => LogTargetType::fromElementClass($element),
'target_id' => $element->getID(),
]));
]);
$query = $qb->getQuery();
$query->setMaxResults(1);

View file

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace App\Repository;
use App\Entity\UserSystem\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\NonUniqueResultException;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
@ -98,10 +97,10 @@ final class UserRepository extends NamedDBElementRepository implements PasswordU
->where('u.name = (:name)')
->orWhere('u.email = (:email)');
$qb->setParameters(new ArrayCollection([
$qb->setParameters([
'email' => $name_or_password,
'name' => $name_or_password,
]));
]);
try {
return $qb->getQuery()->getOneOrNullResult();