0

So I am trying to embark on learning Symfony, and I want to do it right. So I am now thinking about the best way to manage my schemas. Up until now I was mainly using phpMyAdmin to create my tables as I go. But recently I took different approach. I started using workbench ERD modelling and I really like it. As it forces to sort think ahead about the database structure. And I found this:

https://github.com/johmue/mysql-workbench-schema-exporter

This exports the workbench ERD to (i think) Doctrine entities.

Another way I am thinking is to use the migrations. But it would seem like migrations is just the more tedious option which kind of gives the same result (minus the actual entity classes), as you have to type out all the relationships yourself. Whereas in workbench it is drag and drop.

So I suppose, the real question is, how reliable is the first method? Anyone have any experience using it? Would you better recommend using migrations instead? If so why? Is there any other way, I may not be aware?

2
  • If you like it - use it. Software development is about you being productive. Commented May 24, 2015 at 21:16
  • I definitely like it, I am wondering if it is reliable? I had some simole erd model handy which I generated, and it seems to work fine on it. I am just not sure how reliable it is Commented May 24, 2015 at 21:17

2 Answers 2

1

If you want more reliable solution for generating your Doctrine2 ORM definitions (in YML, XML or annotations format), you can take a look at Skipper application.

It's a visual editor for ORM frameworks (Doctrine, Doctrine2, MongoDB ODM, ...) with schema definition import/export support.

Sign up to request clarification or add additional context in comments.

Comments

1

I was using both methods. With the first one you can catch errors with doctrine when will start to create entities related to existing DB schema. With the second one you can catch some issues with foreign keys and existing data (when you change a column type). IMHO the second one is more easier and contains a predictable behavior.

Symfony projects are built based on "Code First" principle. It means that you should create an entity earlier than table in the database. More information you can find at this article.

3 Comments

Answers which just contain links are considered bad practice. Please summarize the content here (don't copy/paste) so the answer can stand on its own. If you don't you run the risk of your answer being removed, especially if the link ever dies.
@MartijnPieters Excuse me, I really don't know anything about this practice. This link contains an additional explanation about "code first" principle. Can I mark it with tag "FYI"?
As it stands, your answer reads this is a link, go read it, then these are my comments on what you just read. We want answers to be self-containing, so it is preferred if your answer read more like this is my answer to your question. If you are interested in this sort of thing, more details can be found in this link here. That way your answer is supported by the link, but the link does not itself form the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.