mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-07 07:14:58 +00:00
js files put in place + select menus added for selecting person/thirdparty/... show-hide not working yet
This commit is contained in:
@@ -11,30 +11,50 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person\PersonResource;
|
||||
use Chill\PersonBundle\Form\PersonResourceType;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use Chill\PersonBundle\Repository\PersonResourceRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
final class PersonResourceController extends AbstractController
|
||||
{
|
||||
private PersonResourceRepository $personResourceRepository;
|
||||
private PersonRepository $personRepository;
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
public function __construct(
|
||||
PersonResourceRepository $personResourceRepository,
|
||||
PersonRepository $personRepository
|
||||
PersonRepository $personRepository,
|
||||
EntityManagerInterface $em
|
||||
)
|
||||
{
|
||||
$this->personResourceRepository = $personResourceRepository;
|
||||
$this->personRepository = $personRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function listAction($person_id)
|
||||
public function listAction(Request $request, $person_id)
|
||||
{
|
||||
$person = $this->personRepository->find($person_id);
|
||||
$personResource = new PersonResource();
|
||||
|
||||
$form = $this->createForm(PersonResourceType::class);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($request->getMethod() === Request::METHOD_POST && $form->isValid()) {
|
||||
$this->em->persist($personResource);
|
||||
$this->em->flush();
|
||||
|
||||
return $this->redirectToRoute(
|
||||
'chill_person_resource',
|
||||
['person_id' => $person->getId()]
|
||||
);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'ChillPersonBundle:PersonResource:list.html.twig',
|
||||
[
|
||||
|
Reference in New Issue
Block a user