This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Creating entities from existing db - question

New topics about Symfony 2 should go here

Creating entities from existing db - question

by work77 » Sun Jan 27, 2013 2:38 pm

Just looking for a little wording clarity from the symfony (doctrine) cookbook found here: ... ering.html

After running doctrine:mapping:convert, it says then...
If you have oneToMany relationships between your entities, you will need to edit the generated xml or yml files to add a section on the specific entities for oneToMany defining the inversedBy and the mappedBy pieces.

Then after running doctrine:mapping:import, it says...
The most impressive thing is that it also discovered the relationship with the BlogPost entity class based on the foreign key constraint.

I'm confused. Do these two statements contradict? The first one is telling me I'll need to manually edit in the relationships. The second one is saying that doctrine "impressively discovers" the relationships. Are they talking about the relationship that I had to explicitly indicate or some other relationship? Bottom line I need to know exactly when doctrine can detect the relationship and when I'll need to edit that into the xml, assuming I always have a foreign key defined.

Junior Member
Posts: 28
Joined: Mon Aug 13, 2012 7:04 am

Re: Creating entities from existing db - question

by taylorr » Mon Jan 28, 2013 9:56 am

Frankly speaking, I will suggest using import instead of convert.

For all the while I am using Symfony, I am very comfortable with setting up my DB in PhpMyAdmin (or like) and then import into Symfony YML. It proves working.
Develop with Symfony, PHP, MySQL
User avatar
Posts: 48
Joined: Fri Jan 16, 2009 10:08 am
Location: Suzhou, China