public function onRender(ViewInterface $view, $template, array $context)
    {
        $this->assertView($view);
        
        $twig = $view->getTwig();
        
        $loader = $this->createFormulaLoader($twig);
        
        $assetManager = $this->createAssetManager($loader);
        $assetManager->setLoader('twig', $loader);   

        $tmpl = $twig->loadTemplate($template);
        
        do {
            $name = (string)$tmpl;
            $resource = $this->createResource($twig, $name);
            $assetManager->addResource($resource, 'twig');
        } while ($tmpl = $tmpl->getParent($context));
        
        $this->writer->writeManagerAssets($assetManager);
    }