Deprecated: Symfony\Component\Translation\t(): Implicitly marking parameter $domain as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/translation/Resources/functions.php on line 18

Deprecated: Symfony\Component\Dotenv\Dotenv::loadEnv(): Implicitly marking parameter $envKey as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/dotenv/Dotenv.php on line 110

Deprecated: Symfony\Component\Runtime\GenericRuntime::getResolver(): Implicitly marking parameter $reflector as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/runtime/GenericRuntime.php on line 89

Deprecated: Symfony\Component\Runtime\RuntimeInterface::getResolver(): Implicitly marking parameter $reflector as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/runtime/RuntimeInterface.php on line 26

Deprecated: Symfony\Component\Console\Input\ArgvInput::__construct(): Implicitly marking parameter $argv as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/console/Input/ArgvInput.php on line 46

Deprecated: Symfony\Component\Console\Input\ArgvInput::__construct(): Implicitly marking parameter $definition as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/console/Input/ArgvInput.php on line 46

Deprecated: Symfony\Component\Console\Input\Input::__construct(): Implicitly marking parameter $definition as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/console/Input/Input.php on line 36

Deprecated: Constant E_STRICT is deprecated in /var/www/html/t/taurushr/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /var/www/html/t/taurushr/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

src/Controller/WisdomController.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\FAQ;
  4. use App\Entity\News;
  5. use App\Annotation\CmsComponent;
  6. use Doctrine\ORM\EntityManagerInterface;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  10. class WisdomController extends AbstractController
  11. {
  12.     public function __construct(private EntityManagerInterface $em)
  13.     {
  14.     }
  15.     /**
  16.      * @CmsComponent("Wisdom Component", active=true, routeName="embed_wisdom_component")
  17.      *
  18.      * @param mixed $request
  19.      */
  20.     #[Route('/wisdom'name'embed_wisdom_component')]
  21.     public function index(): Response
  22.     {
  23.         $faq $this->em->getRepository(FAQ::class)->findOneBy(['deleted' => false'active' => true'featured' => true], ['sortOrder' => 'ASC'], 10);
  24.         $news $this->em->createQuery('SELECT e FROM App:News e WHERE e.deleted = 0 AND e.active = 1 AND e.publishDate <= :now AND e.featuredInWisdomComponent = 1 ORDER BY e.publishDate DESC')
  25.             ->setParameter('now', new \DateTime())
  26.             ->setMaxResults(1)
  27.             ->getOneOrNullResult();
  28.         if (! $faq && ! $news) {
  29.             return new Response('');
  30.         }
  31.         return $this->render('@theme/wisdom/featured.html.twig', [
  32.             'faq' => $faq,
  33.             'news' => $news,
  34.         ]);
  35.     }
  36. }