Tables ayant deux relations sur une même tables
bonjour
j'ai une table commande (regroupant les commande sur un e-commerce).
cette table possède deux id vers la tables adresse, un pour l'adresse de livraison et un pour l'adresse de facturation.
J'ai un soucis pour déclarer les relations afin de pouvoir faire
Code:
1 2 3 4
| <?php
echo $commande->getAdresseLivraison();
echo $commande->getAdresseFacturation();
?> |
Voici mon schema
schema.yml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Commande:
actAs: { Timestampable: ~ }
columns:
id:
type: integer
autoincrement: true
primary: true
client_id: { type: integer }
adresse_fac: { type: integer }
adresse_liv: { type: integer }
paiementMethode_id: { type: integer }
paiementTotal: { type: decimal }
paiementStatut: { type: integer }
paiementDate: { type: date }
transaction_id: { type: integer }
relations:
Client:
local: client_id
foreign: id
foreignAlias: Client
AdresseLivraison:
local: adresse_liv
foreign: id
foreignAlias: Adresse
AdresseFacturation:
local: adresse_fac
foreign: id
foreignAlias: Adresse |