Sunday, March 9, 2014

ORM Designer - My first look and review

I recently started using Symfony2 for developing most of my new sites using the Doctrine2 ORM (Object Relational Mapping) that comes bundled with the standard distribution of Symfony2.  Before using Symfony2 I had never worked with an ORM package before.  I have a lot of experience (20+ years) accessing a database through stored procedures and prepared SQL statements in many different languages and platforms. Using Doctrine2 was a major change and I wanted to like it.

After deploying a couple of simple sites with a database back-end with hand coded Doctrine2 XML entities I thought I had it down.  Along comes a project that has a large multiple domain database and I quickly started to lose track of all of my relationships and had a hard time visualizing the database to create new relationships.

I was using MySql Workbench which had nice diagramming and modeling but it lacked an efficient way of moving my changes back to my Doctrine XML Entity definitions once I made a changes to the database. My only choice was to use the Symfony2 Doctrine import console command and that would end up overwriting parts of my entities such as lifetime callbacks so it only works at the start of a project before you add custom logic to your entities.  After that you are better off just modifying your XML, YAML or PHP annotations manually.

I prefer XML over YAML or PHP Annotations due to the schema validation while manually creating the files and the flexibility.  I know a lot of people like Annotations because it keeps everything on one place but I find them to be hard to document and I feel they just don't belong in my PHP classes.  With the XML Doctrine2 config I can easily write utilities to generate reports, trigger events and validate data.  That's just my opinion but luckily ORM Designer handles all three types of entity definitions with Doctrine2.

I started my search for some sort of visual ORM designer and the only one that I found (I looked for a while) was ORM Designer.  I started the free 14 day trial and imported the XML entities that I had already created by hand across multiple Bundles in my workspace and immediately saw an easy to read diagram of my database.  I also saw a few very obvious relationship problems that I had created due to the fact that I was and still am an ORM rookie.

With a few clicks per relationship I was able to fix these issues and I thought, that was easy!  Ooops, not so fast.  I started with an early version of my project that only had 3 bundles and 6 entities.  That eventually expanded to a dozen or so Bundles with 35+ entities.  I am glad I did not start my experiment there.  The issue is that when I imported the project into ORM Designed by pointing at the symfony/src directory that contains all of my bundles it placed all of the entities under one Module using the PHP namspace for that last bundle.  That caused the export of the fixed relationships to be placed in the wrong directory.  I am not much of a "read the documentation" person so I chalked this up to my rushing in without any knowledge of the software.  To be honest I have still not read much of documentation on the software.

That was the only part that I did not care for while playing with ORM Designer.  I quickly realized that I should have a separate project per Module and that I could link those to a master project.  I later found this which confirmed my observations.  Once I had the Modules linked to a project everything worked great. My PHP Namespaces were correct and my diagram was not nicely colorized by Module and organized on my screen.

I have since imported another 4 modules (Symfony2 Bundles) to my ORM Designer project and I could not be happier.  It is nice that when you have updated your models there is an "Export to ORM" button that writes out all of my Doctrine2 XML configs so that all I have to do is run

app/console doctrine:generate:entities MyBundleName
app/console doctrine:schema:update --force

and my PHP classes and database are up to date with my changes.

It lets me create PDFs that I can share with everyone else on the team.  It does not have the ability as far as I can tell to make a PDF that prints nicely across several pages but we never print anything anymore.  Looking at it on screen with panning and zooming has been fine.  There is a "Print" menu item that is grayed out that I imagine would allow for organizing multiple paged PDFs or prints but since it is not enabled yet I can't tell.  It is a feature that they are working on.

The user interface is pretty straight forward.  I do not like the Ribbon Bar concept but at least there are only 3 tabs so that finding what I want is not difficult.  The rest of the UI is a bit strange in some areas but nothing that gets in the way of being productive.

There is a project browser on the left side of the main window that lets you see an easy tree view of your  project and modules.  It has a great "Project Browser Filter" that lets you find what you are looking for very easily including fields, keys, indexes and tables.  On a large project this is great.  As of this writing I am on version and I have not experienced any crashes or abnormal behavior beyond what I have caused myself.

I do wish there was a way to change the keyboard shortcuts for the Ribbon Bar buttons but that is a minor annoyance for me and might not be an issue for everyone.  I mostly use the shortcut for switching between the selection arrow and panning mode.  I use 2x24inch 16:10 monitors so I have a good amount of screen real estate but even then I find myself switching between select and pan often and CTRL+1 and CTRL+2 are not great in my opinion.  There is a "Locate Object" context item in the Project Tree that will jump to your entity in the diagram immediately but there is no shortcut for that since it is context aware.  I try to use the mouse as little as possible so nice keyboard shortcuts are important to me.

The price of $395 USD is a bit steep in my opinion for a single developer but so far it has made me much more confident in creating and changing my database models.  I am working with a team but we all cover our own expenses for now until we get some income flowing and nobody else is willing to cough up that price. In the end it does not matter that much since once we decide on a database modification I take it home and implement it easily with ORM Designer and push the modified Doctrine Entity XML and PHP files to Bitbucket for everyone else to consume.

I have no experience with any of the other ORMs or Frameworks so in the end here are the bullets for using ORM Designer with Symfony2 and Doctrine2:

  • Fairly easy import of existing Doctrine projects
  • Easy visualization of Entities and their relationships
  • Organizing Entities by Module (Symfony2 Bundle)
  • Easy export of modifications back to your Symfony2 project
  • Easy to locate fields, indexes, classes across multiple modules using the "Project Browser Filter"
  • The license is valid for two computers

  • I don't care for the keyboard shortcuts for some of the actions and they don't appear to be configurable
  • Price is bit high
  • No configuration options for generating PDFs
  • No printing available yet

No comments :

Post a Comment