Creating entities from existing db - question

New topics about Symfony 2 should go here

Moderators: tiagojsag, dcobalt

Creating entities from existing db - question

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

Just looking for a little wording clarity from the symfony (doctrine) cookbook found here:
http://symfony.com/doc/2.0/cookbook/doc ... 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.

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

Re: Creating entities from existing db - question

Postby 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
taylorr
Member
 
Posts: 47
Joined: Fri Jan 16, 2009 10:08 am
Location: Suzhou, China


Return to General Symfony 2 discussion

Who is online

Users browsing this forum: Bing [Bot], Google Feedfetcher and 1 guest

cron