Compare commits
No commits in common. "9c132cfbc06309d2ec158a016d63bf5d1b202271" and "a70e24abc19771996740280aec0a095a45994d3b" have entirely different histories.
9c132cfbc0
...
a70e24abc1
@ -87,11 +87,17 @@ final class AnnouncementController extends AbstractController
|
|||||||
#[Route('/new', name: 'app_announcement_new', methods: ['GET', 'POST'])]
|
#[Route('/new', name: 'app_announcement_new', methods: ['GET', 'POST'])]
|
||||||
public function new(Request $request,): Response
|
public function new(Request $request,): Response
|
||||||
{
|
{
|
||||||
$user = $this->getUser();
|
/*$user = $this->getUser();
|
||||||
|
|
||||||
if (in_array('ROLE_EMPLOYEE', $user->getRoles())) {
|
if (in_array('ROLE_EMPLOYEE', $user->getRoles())) {
|
||||||
$company = $user->getCompany();
|
$company = $user->getCompany();
|
||||||
|
|
||||||
|
if (!$company)
|
||||||
|
{
|
||||||
|
echo "Compétez votre profile avant de créer une annonce";
|
||||||
|
$this->redirectToRoute('app_user_edit',['id' => $user->getId(),]);
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
$announcement = new Announcement();
|
$announcement = new Announcement();
|
||||||
$form = $this->createForm(AnnouncementType::class, $announcement);
|
$form = $this->createForm(AnnouncementType::class, $announcement);
|
||||||
@ -100,7 +106,6 @@ final class AnnouncementController extends AbstractController
|
|||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$announcement->setCreationDate(new \DateTime());
|
$announcement->setCreationDate(new \DateTime());
|
||||||
$announcement->setStatus('notVerified');
|
$announcement->setStatus('notVerified');
|
||||||
$announcement->setCompany($company);
|
|
||||||
$this->entityManager->persist($announcement);
|
$this->entityManager->persist($announcement);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
@ -110,7 +115,6 @@ final class AnnouncementController extends AbstractController
|
|||||||
return $this->render('announcement/new.html.twig', [
|
return $this->render('announcement/new.html.twig', [
|
||||||
'announcement' => $announcement,
|
'announcement' => $announcement,
|
||||||
'form' => $form,
|
'form' => $form,
|
||||||
'company' => $company
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user