Skip to content

Commit

Permalink
Merge pull request #296 from jolicode/joelwurtz-patch-1
Browse files Browse the repository at this point in the history
Event talk submit in user land
  • Loading branch information
welcoMattic authored Nov 15, 2023
2 parents d1ab8ea + 9df1a9e commit a711c0e
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 a711c0e

Please sign in to comment.