Generating diagrams
DoctrineDiagramBundle provides two Symfony commands to generate diagrams from your database:
doctrine:diagram:er- To generate Entity-Relationship diagrams.doctrine:diagram:class- To generate Class diagrams.
Generating Entity-Relationship diagrams
An Entity-Relationship (ER) diagram visually represents the entities (such as tables) in a database, their attributes (such as columns), and the relationships between them.
Use the following command to generate Entity-Relationship diagrams:
You can also use the following shortcut:
If you are using the default configuration, a file named er.svg will be
created at the root of your project.
If your application uses multiple databases, you can specify which DBAL
connection to use using the --connection option:
You can also set the DBAL connection in doctrine_diagram.yaml.
See configuration for the available command options and
configuration file settings.
Set connection to null, and the default connection will be used.
Generating Class diagrams
A UML Class diagram visually represents the Doctrine Entities in your project, including their properties, methods, and the relationships between them.
Use the following command to generate Class diagrams:
You can also use the following shortcut:
Info
DoctrineDiagramBundle will only use Doctrine entities to generate the
diagram. Additionally, only properties with the ORM\Column attribute are
displayed, other class properties are ignored.
If you are using the default configuration, a file named class.svg will be
created at the root of your project.
If your application uses multiple databases, you can specify which Entity
Manager to use using the --em option:
In doctrine_diagram.yaml:
Set em to null, and the default Entity Manager will be used.
How to pipe output
Use php://stdout as the destination file to redirect image to standard output.
For example: