Skip to content

Commit

Permalink
Event talk submit in user land
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwurtz authored and welcoMattic committed Nov 15, 2023
1 parent d1ab8ea commit 9df1a9e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Controller/UserAccount/TalkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

use App\Entity\Talk;
use App\Entity\User;
use App\Event\NewTalkSubmittedEvent;
use App\Form\UserAccount\EditTalkType;
use App\Form\UserAccount\NewTalkType;
use App\Repository\TalkRepository;
use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
Expand All @@ -20,6 +22,7 @@ class TalkController extends AbstractController
public function __construct(
private TalkRepository $talkRepository,
private EntityManagerInterface $em,
private EventDispatcherInterface $eventDispatcher,
) {
}

Expand All @@ -44,6 +47,7 @@ public function userTalks(Request $request): Response
);

$this->addFlash('info', $message);
$this->eventDispatcher->dispatch(new NewTalkSubmittedEvent($talk, $talk->getSubmits()->toArray()));

return $this->redirectToRoute('user_talks');
}
Expand Down

0 comments on commit 9df1a9e

Please sign in to comment.