mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Simplified mapping of TagInfo objects
This commit is contained in:
@@ -110,7 +110,7 @@ class TagRepository extends EntitySpecificationRepository implements TagReposito
|
||||
|
||||
return map(
|
||||
$this->getEntityManager()->createNativeQuery($nativeQb->getSQL(), $rsm)->getResult(),
|
||||
static fn (array $row) => new TagInfo($row['tag'], (int) $row['shortUrlsCount'], (int) $row['visitsCount']),
|
||||
TagInfo::fromRawData(...),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,11 @@ final class TagInfo implements JsonSerializable
|
||||
) {
|
||||
}
|
||||
|
||||
public static function fromRawData(array $data): self
|
||||
{
|
||||
return new self($data['tag'], (int) $data['shortUrlsCount'], (int) $data['visitsCount']);
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -14,6 +14,7 @@ final class TagsParams extends AbstractInfinitePaginableListParams
|
||||
private function __construct(
|
||||
public readonly ?string $searchTerm,
|
||||
public readonly Ordering $orderBy,
|
||||
/** @deprecated */
|
||||
public readonly bool $withStats,
|
||||
?int $page,
|
||||
?int $itemsPerPage,
|
||||
|
||||
Reference in New Issue
Block a user