mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 09:43:13 +08:00
Inject ShortUrlRepository in UrlShortener
This commit is contained in:
@@ -17,14 +17,15 @@ use Shlinkio\Shlink\Core\ShortUrl\Model\UrlShorteningResult;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Repository\ShortUrlRepositoryInterface;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Resolver\ShortUrlRelationResolverInterface;
|
||||
|
||||
class UrlShortener implements UrlShortenerInterface
|
||||
readonly class UrlShortener implements UrlShortenerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ShortUrlTitleResolutionHelperInterface $titleResolutionHelper,
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly ShortUrlRelationResolverInterface $relationResolver,
|
||||
private readonly ShortCodeUniquenessHelperInterface $shortCodeHelper,
|
||||
private readonly EventDispatcherInterface $eventDispatcher,
|
||||
private ShortUrlTitleResolutionHelperInterface $titleResolutionHelper,
|
||||
private EntityManagerInterface $em,
|
||||
private ShortUrlRelationResolverInterface $relationResolver,
|
||||
private ShortCodeUniquenessHelperInterface $shortCodeHelper,
|
||||
private EventDispatcherInterface $eventDispatcher,
|
||||
private ShortUrlRepositoryInterface $repo,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -70,9 +71,7 @@ class UrlShortener implements UrlShortenerInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var ShortUrlRepositoryInterface $repo */
|
||||
$repo = $this->em->getRepository(ShortUrl::class);
|
||||
return $repo->findOneMatching($creation);
|
||||
return $this->repo->findOneMatching($creation);
|
||||
}
|
||||
|
||||
private function verifyShortCodeUniqueness(ShortUrlCreation $meta, ShortUrl $shortUrlToBeCreated): void
|
||||
|
||||
Reference in New Issue
Block a user