mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
draft submit form #14
This commit is contained in:
parent
ffa568275f
commit
731624d886
5 changed files with 340 additions and 130 deletions
37
src/Service/PageService.php
Normal file
37
src/Service/PageService.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use App\Entity\Page;
|
||||
use App\Repository\PageRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
class PageService
|
||||
{
|
||||
private EntityManagerInterface $entityManager;
|
||||
private PageRepository $pageRepository;
|
||||
private ParameterBagInterface $parameterBagInterface;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $entityManager,
|
||||
ParameterBagInterface $parameterBagInterface
|
||||
)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
$this->pageRepository = $entityManager->getRepository(Page::class);
|
||||
$this->parameterBagInterface = $parameterBagInterface;
|
||||
}
|
||||
|
||||
public function new(): ?Page
|
||||
{
|
||||
return new Page();
|
||||
}
|
||||
|
||||
public function save(Page $page) : void
|
||||
{
|
||||
$this->entityManager->persist($page);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue