Updated to lcobucci/json 4.0 stable

This commit is contained in:
Alejandro Celaya 2020-11-29 12:54:22 +01:00
parent 5db66dcf0e
commit 1975a35837
3 changed files with 6 additions and 28 deletions

View File

@ -32,7 +32,7 @@
"laminas/laminas-paginator": "^2.8", "laminas/laminas-paginator": "^2.8",
"laminas/laminas-servicemanager": "^3.4", "laminas/laminas-servicemanager": "^3.4",
"laminas/laminas-stdlib": "^3.2", "laminas/laminas-stdlib": "^3.2",
"lcobucci/jwt": "^4.0@beta", "lcobucci/jwt": "^4.0",
"league/uri": "^6.2", "league/uri": "^6.2",
"lstrojny/functional-php": "^1.9", "lstrojny/functional-php": "^1.9",
"mezzio/mezzio": "^3.2", "mezzio/mezzio": "^3.2",

View File

@ -19,12 +19,6 @@ class ShortUrlRepositoryAdapter implements AdapterInterface
$this->params = $params; $this->params = $params;
} }
/**
* Returns a collection of items for a page.
*
* @param int $offset Page offset
* @param int $itemCountPerPage Number of items per page
*/
public function getItems($offset, $itemCountPerPage): array // phpcs:ignore public function getItems($offset, $itemCountPerPage): array // phpcs:ignore
{ {
return $this->repository->findList( return $this->repository->findList(
@ -37,15 +31,6 @@ class ShortUrlRepositoryAdapter implements AdapterInterface
); );
} }
/**
* Count elements of an object
* @link http://php.net/manual/en/countable.count.php
* @return int The custom count as an integer.
* </p>
* <p>
* The return value is cast to an integer.
* @since 5.1.0
*/
public function count(): int public function count(): int
{ {
return $this->repository->countList( return $this->repository->countList(

View File

@ -33,15 +33,9 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI
?DateRange $dateRange = null ?DateRange $dateRange = null
): array { ): array {
$qb = $this->createListQueryBuilder($searchTerm, $tags, $dateRange); $qb = $this->createListQueryBuilder($searchTerm, $tags, $dateRange);
$qb->select('DISTINCT s'); $qb->select('DISTINCT s')
->setMaxResults($limit)
// Set limit and offset ->setFirstResult($offset);
if ($limit !== null) {
$qb->setMaxResults($limit);
}
if ($offset !== null) {
$qb->setFirstResult($offset);
}
// In case the ordering has been specified, the query could be more complex. Process it // In case the ordering has been specified, the query could be more complex. Process it
if ($orderBy !== null && $orderBy->hasOrderField()) { if ($orderBy !== null && $orderBy->hasOrderField()) {
@ -147,7 +141,7 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI
WHERE s.shortCode = :shortCode WHERE s.shortCode = :shortCode
AND (s.domain IS NULL OR d.authority = :domain) AND (s.domain IS NULL OR d.authority = :domain)
ORDER BY s.domain {$ordering} ORDER BY s.domain {$ordering}
DQL; DQL;
$query = $this->getEntityManager()->createQuery($dql); $query = $this->getEntityManager()->createQuery($dql);
$query->setMaxResults(1) $query->setMaxResults(1)
@ -220,9 +214,8 @@ DQL;
} }
if ($meta->hasValidUntil()) { if ($meta->hasValidUntil()) {
$qb->andWhere($qb->expr()->eq('s.validUntil', ':validUntil')) $qb->andWhere($qb->expr()->eq('s.validUntil', ':validUntil'))
->setParameter('validUntil', $meta->getValidUntil()); ->setParameter('validUntil', $meta->getValidUntil());
} }
if ($meta->hasDomain()) { if ($meta->hasDomain()) {
$qb->join('s.domain', 'd') $qb->join('s.domain', 'd')
->andWhere($qb->expr()->eq('d.authority', ':domain')) ->andWhere($qb->expr()->eq('d.authority', ':domain'))