<?php

namespace App\Twig;

use App\Entity\GlobalParameter;
use Doctrine\ORM\EntityManager;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

class MlcGlobalsExtension extends AbstractExtension implements GlobalsInterface
{
    protected $em;

    public function __construct(EntityManager $em)
    {
        $this->em = $em;
    }

    public function getGlobals()
    {
        return $this->em->getRepository(GlobalParameter::class)->findAllByName();
    }
}
