Il faut alors faire un héritage en inventant une entité mère Participant.
Règles de gestion :
1) Un participant participe à un à plusieurs événements et un événement voit la participation de un à plusieurs participants.
2) Un client est un participant et un participant peut être un client
3) Un groupe_client est un participant et un participant peut être un groupe_client
4) Un client peut appartenir un groupe_client et un groupe_client possède de un à plusieurs clients
MCD :
client -0.n-------------------appartenir--------------1,n- groupe_client
|----(1,1)----être----0,1- participant -0,1----être----(1,1)---|
|
evenement -0,n----avoir----0,n---|
Tables :
evenement (evt_id, ...)
participant (prt_id,...)
prt_participer_evt (ppe_id_participant, ppe_id_evenement)
client (clt_id_participant, ...)
groupe_client (gct_id_participant,...)
clt_appartenir_gct (cag_id_client, cag_id_groupe)
Dans ce MCD, j'ai fait une identification relative du client ou du groupe_client par rapport au participant, ce qui fait que le client ou le groupe_client récupère l'identifiant du participant. Mais on peut faire l'inverse si la participation d'un client ou d'un groupe de client n'est qu'un aspect secondaire du modèle et que les entités fortes ici sont le client et le groupe_client :
client -0.n-------------------appartenir--------------1,n- groupe_client
|----0,1----être----(0,1)- participant -(0,1)----être----0,1---|
|
evenement -0,n----avoir----0,n---|
Il faudra alors faire une légère entorse aux bonnes pratiques en ignorant que normalement une association 0,1-0,1 donne une table associative. Ce serait ici superflu du fait de l'identification relative de particpant depuis client ou groupe_client. C'est quasiment un héritage à l'envers !
Tables :
client (clt_id, ...)
groupe_client (gct_id,...)
clt_appartenir_gct (cag_id_client, cag_id_groupe)
evenement (evt_id, ...)
participant (prt_id,...) <= soit l'id du client, soit l'id du groupe_client !
prt_participer_evt (ppe_id_participant, ppe_id_evenement)
Dans ce second modèle, la structure de la table participant est quand même un poil ambigüe ! Pas de gestion de clé étrangère possible !
Partager