-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* gvdump.php | |
* | |
* @author: Frédéric G. MARAND <[email protected]> | |
* | |
* @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