Reputation: 77
I start a project with symfony. I debute with the design of the data base.
My project consist to manage the treatment cycle of the an patient with several entites.
concretely: An entity patient should have a relation with social security entity, hospital, pharmacy, doctor , nurse, Personne to contact, and other.
The question is, what is the best data base schema the organize relations between entites using doctrine with symfony.
Should i use one to one and one to many , many to many directly between patient entity and the other entites or using and intermediate table.
Thank you in advance for your answers
Upvotes: 2
Views: 74
Reputation: 583
I wouldn't do it with intermediate tables, just in the case that I explain below, so...
Patient could be in different hospitals databases - ManyToMany
Patient must be in just one social security (In the same country) - ManyToOne
Patient could be in different pharmacies databases - ManyToMany
Patient just has one General Doctor - ManyToOne
Patient could has more than one Person to contact - ManyToMany
Patient could has more than one nurse taking care of him - ManyToMany
Maybe I'm wrong in some of them, if it's like this correct me
http://doctrine-orm.readthedocs.org/en/latest/reference/association-mapping.html
Check how to connect them through Doctrine, you should create a intermediate table when you're going to use this connection quite a lot
Upvotes: 1