Reputation: 4299
i got snared up on a personal project last night when i built my db schema, imported the mapping for only the tables related to that bundle, generated the entities, then tried to generate a crud for it. the problem is, the bundle is for db entities related to dog characteristics/images/notes, etc... but the main dog table shares an FK with a user table, which will go on either a core bundle, or a user bundle.
When i went to generate the crud for the dog bundles, it snared up when it couldnt access the entity it was looking for for the FK in the user table, because that entity hasnt been generated yet.
is there a way to cross relate these bundles somehow so i can overcome this?
Upvotes: 0
Views: 147
Reputation: 4299
I came up with my own solution until somebody has a better idea.
Since the secondary bundle (dog bundle) depended on the user entity via a fk relationship, and the crud generator depended on this, a light bulb turned on.
Solution: I simply also mapped the schema AND generated an entity for that user entity inside the secondary bundle as well. This means I ended up with two user entity's, one in the core bundle where the user control is, and one in the secondary bundle because it depended on this relationship.
Now when you go to generate a crud in the secondary bundle, it has a user entity object to work with so it can properly map across all the tables. I was then able to successfully automatically generate the crud's for the secondary bundle.
If anybody has a better solution, I would like to hear about it, because I don't want two identical entities in my app unless absolutely or practically necessary.
Upvotes: 0