mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 10:49:00 +02:00
Fixed errors that query builder setParameters now expects an ArrayCollection instead of an array
This commit is contained in:
parent
60325e797d
commit
78671b0bfe
2 changed files with 12 additions and 10 deletions
|
@ -30,6 +30,7 @@ use App\Entity\LogSystem\ElementDeletedLogEntry;
|
||||||
use App\Entity\LogSystem\ElementEditedLogEntry;
|
use App\Entity\LogSystem\ElementEditedLogEntry;
|
||||||
use App\Entity\LogSystem\LogTargetType;
|
use App\Entity\LogSystem\LogTargetType;
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,10 +86,10 @@ class LogEntryRepository extends DBElementRepository
|
||||||
->orderBy('log.timestamp', 'DESC')
|
->orderBy('log.timestamp', 'DESC')
|
||||||
->setMaxResults(1);
|
->setMaxResults(1);
|
||||||
|
|
||||||
$qb->setParameters([
|
$qb->setParameters(new ArrayCollection([
|
||||||
'target_type' => LogTargetType::fromElementClass($class),
|
'target_type' => LogTargetType::fromElementClass($class),
|
||||||
'target_id' => $id,
|
'target_id' => $id,
|
||||||
]);
|
]));
|
||||||
|
|
||||||
$query = $qb->getQuery();
|
$query = $qb->getQuery();
|
||||||
|
|
||||||
|
@ -121,11 +122,11 @@ class LogEntryRepository extends DBElementRepository
|
||||||
->andWhere('log.timestamp >= :until')
|
->andWhere('log.timestamp >= :until')
|
||||||
->orderBy('log.timestamp', 'DESC');
|
->orderBy('log.timestamp', 'DESC');
|
||||||
|
|
||||||
$qb->setParameters([
|
$qb->setParameters(new ArrayCollection([
|
||||||
'target_type' => LogTargetType::fromElementClass($element),
|
'target_type' => LogTargetType::fromElementClass($element),
|
||||||
'target_id' => $element->getID(),
|
'target_id' => $element->getID(),
|
||||||
'until' => $until,
|
'until' => $until,
|
||||||
]);
|
]));
|
||||||
|
|
||||||
$query = $qb->getQuery();
|
$query = $qb->getQuery();
|
||||||
|
|
||||||
|
@ -147,11 +148,11 @@ class LogEntryRepository extends DBElementRepository
|
||||||
->andWhere('log.timestamp >= :until')
|
->andWhere('log.timestamp >= :until')
|
||||||
->orderBy('log.timestamp', 'DESC');
|
->orderBy('log.timestamp', 'DESC');
|
||||||
|
|
||||||
$qb->setParameters([
|
$qb->setParameters(new ArrayCollection([
|
||||||
'target_type' => LogTargetType::fromElementClass($element),
|
'target_type' => LogTargetType::fromElementClass($element),
|
||||||
'target_id' => $element->getID(),
|
'target_id' => $element->getID(),
|
||||||
'until' => $timestamp,
|
'until' => $timestamp,
|
||||||
]);
|
]));
|
||||||
|
|
||||||
$query = $qb->getQuery();
|
$query = $qb->getQuery();
|
||||||
$count = $query->getSingleScalarResult();
|
$count = $query->getSingleScalarResult();
|
||||||
|
@ -232,10 +233,10 @@ class LogEntryRepository extends DBElementRepository
|
||||||
->andWhere('log.target_id = :target_id')
|
->andWhere('log.target_id = :target_id')
|
||||||
->orderBy('log.timestamp', 'DESC');
|
->orderBy('log.timestamp', 'DESC');
|
||||||
|
|
||||||
$qb->setParameters([
|
$qb->setParameters(new ArrayCollection([
|
||||||
'target_type' => LogTargetType::fromElementClass($element),
|
'target_type' => LogTargetType::fromElementClass($element),
|
||||||
'target_id' => $element->getID(),
|
'target_id' => $element->getID(),
|
||||||
]);
|
]));
|
||||||
|
|
||||||
$query = $qb->getQuery();
|
$query = $qb->getQuery();
|
||||||
$query->setMaxResults(1);
|
$query->setMaxResults(1);
|
||||||
|
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||||
namespace App\Repository;
|
namespace App\Repository;
|
||||||
|
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\ORM\NonUniqueResultException;
|
use Doctrine\ORM\NonUniqueResultException;
|
||||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||||
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
||||||
|
@ -97,10 +98,10 @@ final class UserRepository extends NamedDBElementRepository implements PasswordU
|
||||||
->where('u.name = (:name)')
|
->where('u.name = (:name)')
|
||||||
->orWhere('u.email = (:email)');
|
->orWhere('u.email = (:email)');
|
||||||
|
|
||||||
$qb->setParameters([
|
$qb->setParameters(new ArrayCollection([
|
||||||
'email' => $name_or_password,
|
'email' => $name_or_password,
|
||||||
'name' => $name_or_password,
|
'name' => $name_or_password,
|
||||||
]);
|
]));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $qb->getQuery()->getOneOrNullResult();
|
return $qb->getQuery()->getOneOrNullResult();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue