src/Controller/Admin/ArchiveMovieController.php line 11

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Controller\Admin;
  4. use Doctrine\ORM\EntityManagerInterface;
  5. use JMS\JobQueueBundle\Entity\Job;
  6. use Sonata\AdminBundle\Controller\CRUDController;
  7. class ArchiveMovieController extends CRUDController
  8. {
  9.     /** @var EntityManagerInterface $em */
  10.     private $em;
  11.     public function __construct(EntityManagerInterface $em)
  12.     {
  13.         $this->em $em;
  14.     }
  15.     public function listAction()
  16.     {
  17.         $job = new Job('fetch:archivemovie');
  18.         $this->em->persist($job);
  19.         $this->em->flush();
  20.         return $this->redirectToRoute('jms_jobs_details', ['id' => $job->getId()]);
  21.     }
  22. }