src/Twig/ManagerExtension.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Twig;
  3. use App\Services\Manage\Checklist;
  4. use App\Services\Manage\Manager;
  5. use Twig\Extension\AbstractExtension;
  6. use Twig\TwigFilter;
  7. use Twig\TwigFunction;
  8. class ManagerExtension extends AbstractExtension
  9. {
  10.     public function __construct(Manager $manager)
  11.     {
  12.         $this->manager $manager;
  13.     }
  14.     public function getFunctions(): array
  15.     {
  16.         return [
  17.             new  TwigFunction('getManagerChecklist', [$this'getManagerChecklist']),
  18.             new  TwigFunction('getManagerProjects', [$this'getManagerProjects']),
  19.         ];
  20.     }
  21.     public function getManagerChecklist($checklistID)
  22.     {
  23.         return $this->manager->getChecklist($checklistID);
  24.     }
  25.     public function getManagerProjects($userID)
  26.     {
  27.         return $this->manager->getProjects($userID);
  28.     }
  29. }