Start on creating snipContent entities for the db content
This commit is contained in:
@ -4,6 +4,8 @@ namespace App\Service;
|
||||
|
||||
use App\Entity\Snip;
|
||||
use App\Git\CustomGit;
|
||||
use App\Repository\SnipContentRepository;
|
||||
use App\Service\SnipContent\SnipContentDB;
|
||||
use App\Service\SnipContent\SnipContentGit;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
|
||||
@ -11,13 +13,14 @@ class SnipServiceFactory
|
||||
{
|
||||
|
||||
public function __construct(
|
||||
private readonly string $snipBasePath,
|
||||
private readonly Security $security,
|
||||
private readonly string $snipBasePath,
|
||||
private readonly Security $security,
|
||||
private readonly SnipContentRepository $snipContentRepository,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function create(Snip $snip): SnipContentGit
|
||||
public function createGit(Snip $snip): SnipContentGit
|
||||
{
|
||||
$git = new CustomGit();
|
||||
$repoPath = sprintf('%s/%s', $this->snipBasePath, $snip->getId());
|
||||
@ -31,4 +34,9 @@ class SnipServiceFactory
|
||||
}
|
||||
return new SnipContentGit($repo, $this->security->getUser());
|
||||
}
|
||||
|
||||
public function createDB(Snip $snip): SnipContentDB
|
||||
{
|
||||
return new SnipContentDB($snip, $this->security->getUser(), $this->snipContentRepository);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user