src/Twig/MessagesExtension.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Twig;
  3. use App\Services\Messages;
  4. use Twig\Extension\AbstractExtension;
  5. use Twig\TwigFilter;
  6. use Twig\TwigFunction;
  7. class MessagesExtension extends AbstractExtension
  8. {
  9.     public function __construct(Messages $message)
  10.     {
  11.         $this->message $message;
  12.     }
  13.     public function getFunctions(): array
  14.     {
  15.         return [
  16.             new  TwigFunction('getMessagesCountMessages', [$this'getMessagesCountMessages']),
  17.         ];
  18.     }
  19.     public function getMessagesCountMessages($topicID)
  20.     {
  21.         return $this->message->getCountMessages($topicID);
  22.     }
  23. }