Added logic to resolve crawlable short codes

This commit is contained in:
Alejandro Celaya
2021-05-22 09:34:42 +02:00
parent e6ce84aa14
commit 3ef02d46c0
6 changed files with 88 additions and 4 deletions

View File

@@ -4,10 +4,23 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Crawling;
use Doctrine\ORM\EntityManagerInterface;
use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Repository\ShortUrlRepositoryInterface;
class CrawlingHelper implements CrawlingHelperInterface
{
private EntityManagerInterface $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
public function listCrawlableShortCodes(): iterable
{
return [];
/** @var ShortUrlRepositoryInterface $repo */
$repo = $this->em->getRepository(ShortUrl::class);
yield from $repo->findCrawlableShortCodes();
}
}