*Tags*: symfony model visualization schema UML diagram
symfony propel-graphviz
dot -Tpng graph/schema.dot -o graph/schema.png
or,
dotty graph/schema.dot &
documented on: 2007.07.13
Adding some simple lines enables propel's graphviz dot file generation:
in /data/symfony/tasks/sfPakePropel.php add:
pake_desc('create a graphviz dot file for current model');
pake_task('propel-graphviz', 'project_exists');and
function run_propel_graphviz($task, $args)
{
_propel_convert_yml_schema(false, 'generated-');
_propel_copy_xml_schema_from_plugins('generated-');
_call_phing($task, 'graphviz');
$finder = pakeFinder::type('file')->name('generated-*schema.xml');
pake_remove($finder, array('config', 'plugins'));
}Now you can use it like that:
> symfony propel-graphviz
...
propel > graphviz:
[echo] +------------------------------------------+
[echo] | |
[echo] | Generating Graphiz for YOUR Propel |
[echo] | project! |
[echo] | |
[echo] +------------------------------------------+
...This creates a folder "graph" in your projects folder containing a "schema.dot" file which can be converted to e.g. a PNG file using the graphviz package from http://www.graphviz.org/
Fonts, colors, shapes etc. can be customized.
documented on: 12 January 2007, roga
Terrific! After simply adding the following line, I got the schema map!!!
$ diff -wU 1 /usr/share/pear/data/symfony/tasks/sfPakePropel.php.org /usr/share/pear/data/symfony/tasks/sfPakePropel.php --- /usr/share/pear/data/symfony/tasks/sfPakePropel.php.org 2007-02-22 09:49:14.000000000 -0500 +++ /usr/share/pear/data/symfony/tasks/sfPakePropel.php 2007-04-12 13:38:45.000000000 -0400 @@ -43,2 +43,5 @@
+pake_desc('create a graphviz dot file for current model');
+pake_task('propel-graphviz', 'project_exists');
+
function run_propel_convert_yml_schema($task, $args)
@@ -383 +386,10 @@
}
+
+function run_propel_graphviz($task, $args)
+{
+ _propel_convert_yml_schema(false, 'generated-');
+ _propel_copy_xml_schema_from_plugins('generated-');
+ _call_phing($task, 'graphviz');
+ $finder = pakeFinder::type('file')->name('generated-*schema.xml');
+ pake_remove($finder, array('config', 'plugins'));
+}francois, why can't we put it directly in sfPakePropel.php, why a plugin instead?
I've submitted a patch, against trunk/data/tasks/sfPakePropel.php latest revision, 3525. Details at: http://trac.symfony-project.org/trac/ticket/1659
check it out and get the patch there.
..a "schema.dot" file which can be converted to e.g. a PNG file using the. graphviz package from http://www.graphviz.org/ Fonts, colors, shapes etc. can be customized…. | ||
| -- roga wrote on Fri 12 January 2007 15:15 | ||
roga, can you elaborate a bit more about them?
Having installed the graphviz package, it took me a while to figure out how to open the .dot file, because there isn't a tool called graphviz. Only after having tried each individual files did I know how to open it:
dotty graph/schema.dot &
Thanks
xpt
I used a GUI (http://home.so-net.net.tw/oodtsen/wingraphviz/index.htm) but as far as I know the command is: dot -Tpng input.dot -o output.png | ||
| -- roga | ||
Thanks, that works:
dot -Tpng graph/schema.dot -o graph/schema.png
What's cool about it is that it can handle all dabase tables from plugins as well. Here is an example from my
[Tutorial] My Second Project - Admin Generator http://www.symfony-project.org/forum/index.php?t=msg&th= 5064&