final commit
This commit is contained in:
parent
a2a9c2a3b1
commit
ebf78e3fe7
@ -87,17 +87,11 @@ final class AnnouncementController extends AbstractController
|
||||
#[Route('/new', name: 'app_announcement_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request,): Response
|
||||
{
|
||||
/*$user = $this->getUser();
|
||||
$user = $this->getUser();
|
||||
|
||||
if (in_array('ROLE_EMPLOYEE', $user->getRoles())) {
|
||||
$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();
|
||||
$form = $this->createForm(AnnouncementType::class, $announcement);
|
||||
@ -106,6 +100,7 @@ final class AnnouncementController extends AbstractController
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$announcement->setCreationDate(new \DateTime());
|
||||
$announcement->setStatus('notVerified');
|
||||
$announcement->setCompany($company);
|
||||
$this->entityManager->persist($announcement);
|
||||
$this->entityManager->flush();
|
||||
|
||||
@ -115,6 +110,7 @@ final class AnnouncementController extends AbstractController
|
||||
return $this->render('announcement/new.html.twig', [
|
||||
'announcement' => $announcement,
|
||||
'form' => $form,
|
||||
'company' => $company
|
||||
]);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user