<?php
namespace App\Twig;
use App\Services\Messages;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;
class MessagesExtension extends AbstractExtension
{
public function __construct(Messages $message)
{
$this->message = $message;
}
public function getFunctions(): array
{
return [
new TwigFunction('getMessagesCountMessages', [$this, 'getMessagesCountMessages']),
];
}
public function getMessagesCountMessages($topicID)
{
return $this->message->getCountMessages($topicID);
}
}