<?php
namespace Modules\Facture\TwigExtension;

use Psr\Container\ContainerInterface;
use Skeleton\Router;

class OutilFactureExtension extends \Twig\Extension\AbstractExtension
{
    protected $pdo;
    protected $contenaire;
    
    public function __construct(\PDO $pdo, ContainerInterface $contenaire)
    {
        $this->pdo = $pdo;
        $this->contenaire = $contenaire;
    }
    
    public function getFunctions()
    {
        return [
            new \Twig\TwigFunction('getContainsCommandeFacture', [
                $this,
                'getContainsCommandeFacture'
            ], [
                'is_safe' => [
                    'html'
                ]
            ]),
        ];
    }
 
    public function getContainsCommandeFacture($numFact)
    {
        $isAffiche = new \Modules\Facture\Repository\GestionFacture($this->pdo);
        return $isAffiche = $isAffiche->getContainsCommandeFacture($numFact);
    }
}
