Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chalasr/5a84b93cecc848d75df50147074640b5 to your computer and use it in GitHub Desktop.
Save chalasr/5a84b93cecc848d75df50147074640b5 to your computer and use it in GitHub Desktop.
Demonstrate how to use the GraphViz Dumper in a Symfony 2.4 project.
<?php
/**
* @file
* gvdump.php
*
* @author: Frédéric G. MARAND <fgm@osinet.fr>
*
* @copyright (c) 2014 Ouest Systèmes Informatiques (OSInet).
*
* @license MIT
*/
$loader = require_once __DIR__ . '/bootstrap.php.cache';
require_once __DIR__ . '/AppKernel.php';
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\DependencyInjection\Dumper\GraphvizDumper;
class DumperKernel extends \AppKernel {
/**
* Initializes the service container.
*/
protected function initializeContainer() {
$container = $this->buildContainer();
$container->compile();
return $container;
}
public function dump() {
$this->initializeBundles();
$container = $this->initializeContainer();
$dumper = new GraphvizDumper($container);
$content = $dumper->dump(array(
'graph' => array(
'rankdir' => 'RL',
),
));
if (!$this->debug) {
$content = static::stripComments($content);
}
echo $content;
}
}
$kernel = new DumperKernel('dev', true);
$kernel->dump();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment