mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Enhanced TagRepositoryTest and replaced inlined quoting by doctrine connection quoting
This commit is contained in:
@@ -142,7 +142,7 @@ class VisitRepository extends EntitySpecificationRepository implements VisitRepo
|
||||
$qb->from(Visit::class, 'v')
|
||||
->join('v.shortUrl', 's')
|
||||
->join('s.tags', 't')
|
||||
->where($qb->expr()->eq('t.name', '\'' . $tag . '\'')); // This needs to be concatenated, not bound
|
||||
->where($qb->expr()->eq('t.name', $this->getEntityManager()->getConnection()->quote($tag)));
|
||||
|
||||
if ($filtering->excludeBots()) {
|
||||
$qb->andWhere($qb->expr()->eq('v.potentialBot', 'false'));
|
||||
|
||||
@@ -17,6 +17,7 @@ class BelongsToApiKeyInlined implements Filter
|
||||
public function getFilter(QueryBuilder $qb, string $dqlAlias): string
|
||||
{
|
||||
// Parameters in this query need to be inlined, not bound, as we need to use it as sub-query later
|
||||
return $qb->expr()->eq('s.authorApiKey', '\'' . $this->apiKey->getId() . '\'')->__toString();
|
||||
$conn = $qb->getEntityManager()->getConnection();
|
||||
return $qb->expr()->eq('s.authorApiKey', $conn->quote($this->apiKey->getId()))->__toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ class BelongsToDomainInlined implements Filter
|
||||
public function getFilter(QueryBuilder $qb, string $context): string
|
||||
{
|
||||
// Parameters in this query need to be inlined, not bound, as we need to use it as sub-query later
|
||||
return $qb->expr()->eq('s.domain', '\'' . $this->domainId . '\'')->__toString();
|
||||
$conn = $qb->getEntityManager()->getConnection();
|
||||
return $qb->expr()->eq('s.domain', $conn->quote($this->domainId))->__toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user