I have completely and totally rewritten my old script that generates a graph of CakePHP models and their relationships. Instead of pasting the code in here, I pushed all of its development to GitHub where it now enjoys a new repository. Please have a look, try it out, and let me know if it does or doesn’t work for you.
The major changes in this version are:
- Rewritten as CakePHP Shell instead of being a standalone madness script.
- Got rid of all dot markup. Utilized Image_GraphViz PEAR package instead.
- Added support for old and new CakePHP versions (1.2, 1.3, and 2.0).
- Added option for using only real models (via className property of the relationship) or sticking with the old behavior.
- Added a bunch of options for tweaking GraphViz output. And now it’s obvious where to edit them, in case you need more.
- Improved the styling of the graph a bit – fonts and colors.
- Improved documentation.
As a side effect improvement, now that it is a native CakePHP Shell, it’s trivial to add to your project build process.