Bonjour,
j'ai besoin de votre aide..
voici un aperçu de mon schema.yml:
Mon objectif est de pouvoir rajouter et gérer des quantités d'articles stockés dans des magasins.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42 Article: .... columns: reference: type: string(50) notnull: true fournisseur: type: string(255) notnull: true ...... relations: Magasins: class: Magasin refClass: ArticleMagasin local: article_id foreign: magasin_id foreignAlias: Articles Magasin: .... columns: nom: type: string(50) notnull: true .... relations: Articles: class: Article refClass: ArticleMagasin local: magasin_id foreign: article_id foreignAlias: Magasins ArticleMagasin: columns: article_id: { type: integer, notnull: true, primary: true } magasin_id: { type: integer, notnull: true, primary: true } quantite: { type: integer, notnull: true } relations: Article: { onDelete: CASCADE, local: article_id, foreign: id, foreignAlias: ArticleMagasins} Magasin: { onDelete: CASCADE, local: magasin_id, foreign: id, foreignAlias: ArticleMagasins}
A partir de ma classe 'ArticleForm', j'ai fait un embedRelation et un embedForm sur la table de jointure'ArticleMagasin':
mon souci c'est que sur mon formulaire imbriqué, il y a que la quantité qui s'affiche, alors que je voudrais renseigner le magasin_id aussi.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 class ArticleForm extends BaseContratForm { public function configure() { parent::configure(); $articleMagasin = new ArticleMagasin(); $articleMagasin->setArticle($this->getObject()); $formArticle = new ArticleMagasinForm($articleMagasin); $this->embedForm('Nouveau stock', $formArticle); $this->embedRelation('ArticleMagasins'); } }
en fait comme la clé primaire de la table de jointure est composée de deux clés (article_id, magasin_id), les deux champs sont cachés.
est-ce que je dois changer le widget pour magasin_id? si oui comment?
sinon est-ce que mon schéma yml est bon?
Merci pour votre aide!!
Partager