alexandresalome / doctrine-extra-bundle
Extra features for Doctrine, as a Symfony bundle
Installs: 269 850
Dependents: 1
Suggesters: 0
Security: 0
Stars: 47
Watchers: 7
Forks: 18
Open Issues: 4
Requires
- alom/graphviz: ~1.1
- doctrine/orm: ^2.7.0
Requires (Dev)
- phpunit/phpunit: ^7.5 || ^8.5
README
Graph tool for Doctrine. Relies on Graphviz.
Installation
Install the latest version with
composer require --dev alexandresalome/doctrine-extra-bundle
Then, enable the bundle by adding the following line in the app/AppKernel.php
file of your project:
// app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { //... if (in_array($this->getEnvironment(), ['dev', 'test'])) { // ... // Because the vendor code could be not present, you should check if the bundle is here before using it. $bundles[] = new Alex\DoctrineExtraBundle\AlexDoctrineExtraBundle(); } // ... } // ... }
Usage
Dump entity manager schema as graph
php app/console doctrine:mapping:graphviz
If you want to create a PDF file out of it, with Linux:
.. code-block:: bash
php app/console doctrine:mapping:graphviz | dot -Tpdf -oout.pdf
xdg-open out.pdf
Development
Generate sample graphs
A set of sample entities are available to test internally the schema generations. You can generate the graph for any of the samples (located in Tests/Fixtures) by running:
./Resources/bin/graph Simple | dot -Tpdf -oout.pdf
xdg-open out.pdf