mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-09 16:53:11 +08:00
Extracted method to find crawlable short codes to its own query object
This commit is contained in:
@@ -4,20 +4,16 @@ declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\Crawling;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Repository\ShortUrlRepositoryInterface;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Repository\CrawlableShortCodesQueryInterface;
|
||||
|
||||
class CrawlingHelper implements CrawlingHelperInterface
|
||||
{
|
||||
public function __construct(private EntityManagerInterface $em)
|
||||
public function __construct(private readonly CrawlableShortCodesQueryInterface $query)
|
||||
{
|
||||
}
|
||||
|
||||
public function listCrawlableShortCodes(): iterable
|
||||
{
|
||||
/** @var ShortUrlRepositoryInterface $repo */
|
||||
$repo = $this->em->getRepository(ShortUrl::class);
|
||||
yield from $repo->findCrawlableShortCodes();
|
||||
yield from ($this->query)();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user