src/Controller/ThemesWebsite/Whileresume/Application/JobsController.php line 47

Open in your IDE?
  1. <?php
  2. namespace App\Controller\ThemesWebsite\Whileresume\Application;
  3. use App\Entity\Core\Users;
  4. use App\Entity\Cvs\Candidates;
  5. use App\Entity\Cvs\CandidatesHasExperiences;
  6. use App\Entity\Cvs\CandidatesHasProjects;
  7. use App\Entity\Cvs\CandidatesHasServices;
  8. use App\Entity\Cvs\CandidatesHasSkills;
  9. use App\Entity\Cvs\Jobs;
  10. use App\Form\Core\UsersType;
  11. use App\Form\Cvs\JobsForm;
  12. use App\Services\Core\RequestData;
  13. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
  14. use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
  15. use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
  16. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  17. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  18. use Symfony\Component\HttpFoundation\Request;
  19. use Symfony\Component\HttpFoundation\Response;
  20. use Symfony\Component\Routing\Annotation\Route;
  21. use Symfony\Component\HttpFoundation\Cookie;
  22. use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
  23. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  24. use Doctrine\ORM\EntityManagerInterface;
  25. class JobsController extends AbstractController
  26. {
  27.     private $rd;
  28.     private $em;
  29.     public function __construct(RequestData $rd,
  30.                                 EntityManagerInterface $em
  31.     ) {
  32.         $this->rd $rd;
  33.         $this->em $em;
  34.     }
  35.     public function new(Request $request): Response
  36.     {
  37.         $locale $request->getLocale();
  38.         $job = new Jobs();
  39.         $form $this->createForm(JobsForm::class, $job);
  40.         $form->handleRequest($request);
  41.         if ($form->isSubmitted() && $form->isValid()) {
  42.             die('ici');
  43.         }
  44.         return $this->render('application/whileresume/application/jobs/new_'.$locale.'.html.twig',[
  45.             'form' => $form->createView(),
  46.         ]);
  47.     }
  48.     public function show(Request $request$slug): Response
  49.     {
  50.         $locale $request->getLocale();
  51.         $job $this->em->getRepository(Jobs::class)->findOneBy(['slug' => $slug]);
  52.         return $this->render('application/whileresume/application/jobs/show_'.$locale.'.html.twig',[
  53.             'slug' => $slug,
  54.             'job' =>  $job,
  55.         ]);
  56.     }
  57. }