J'essaie de créer un modèle de correspondance qui inclut les joueurs alignés pendant ce match. Chaque match a donc de nombreux joueurs et chaque joueur a de nombreux matches.MongoDB et CakePHP Associations du modèle
match = {
'_id' : ObjectID('978tqwbi9873gofiu'),
'home' : 'Argentina',
'away' : 'Brazil',
'lineup-home' : [
{'name' : 'Lionel Messi',
'goals' : '2',
'timeon' : 30
},
{'name' : 'Diego Maradonna',
'goals' : '0',
'timeon' : 0
},
{'name' : 'Sergio Aguero',
'goals' : '0',
'timeon' : 0
}
]
}
Comment puis-je ajouter ces relations « line-up maison » dans mon modèle CakePHP travailler avec mon MongoDB? Voici à quoi ressemble mon modèle ...
class Match extends AppModel {
//var $useDbConfig = 'mongo';
var $mongoSchema = array(
'home' => array('type' => 'string'),
'away' => array('type' => 'string'),
'lineup-home' => ???
);
}
Merci.
Avez-vous déjà trouvé une solution, j'ai la même question? –