Bonjour,
je suis actuellement sur un projet avec symfony, je dois créer un bundle qui permet d'enregistrer un produit d'un concurrent pour comparer son prix,je bloque sur le formulaire, mon formulaire est présenté de cette manière :
Nom : (nom du produit sur ma boutique)
Ref : (ref du produit de ma boutique)
Url du produit : (Url du produit concurrent)
Type: (categorie du produit)
Script : (choix du script a executer pour ce produit celon le concurrent)
le soucis est que si j'ai les deux meme produit chez deux concurrents ou plus je peux mettre qu'une url est il possible d'avoir un ajout automatique d'une colonne dans la base de donnée ainsi qu'un input url_nom du concurrent sans devoir à chaque fois retoucher le code mais entitées sont faite comme ceci :
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170 <?php namespace noza\concurrentBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity */ class Produit { /** * @ORM\GeneratedValue * @ORM\Id * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string",length=255) * @Assert\NotBlank() */ private $nom; /** *@ORM\JoinTable(name="produit_type") * @ORM\ManyToOne(targetEntity="Type") */ private $type; /** * @ORM\Column(type="string",length=14) */ private $refdivalto; /** *@ORM\JoinTable(name="produit_script") * @ORM\ManyToOne(targetEntity="Script") */ private $script; /** * @ORM\Column(type="string",length=255) */ private $url_produit; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set nom * * @param string $nom * @return Produit */ public function setNom($nom) { $this->nom = $nom; return $this; } /** * Get nom * * @return string */ public function getNom() { return $this->nom; } /** * Set refdivalto * * @param string $refdivalto * @return Produit */ public function setRefdivalto($refdivalto) { $this->refdivalto = $refdivalto; return $this; } /** * Get refdivalto * * @return string */ public function getRefdivalto() { return $this->refdivalto; } /** * Set url_produit * * @param string $urlProduit * @return Produit */ public function setUrlProduit($urlProduit) { $this->url_produit = $urlProduit; return $this; } /** * Get url_produit * * @return string */ public function getUrlProduit() { return $this->url_produit; } /** * Set type * * @param \noza\concurrentBundle\Entity\Type $type * @return Produit */ public function setType(\noza\concurrentBundle\Entity\Type $type = null) { $this->type = $type; return $this; } /** * Get type * * @return \noza\concurrentBundle\Entity\Type */ public function getType() { return $this->type; } /** * Set script * * @param \noza\concurrentBundle\Entity\Script $script * @return Produit */ public function setScript(\noza\concurrentBundle\Entity\Script $script = null) { $this->script = $script; return $this; } /** * Get script * * @return \noza\concurrentBundle\Entity\Script */ public function getScript() { return $this->script; } }
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57 <?php namespace noza\concurrentBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity */ class Script { /** * @ORM\GeneratedValue * @ORM\Id * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string",length=255) * @Assert\NotBlank() */ private $nom; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set nom * * @param string $nom * @return Script */ public function setNom($nom) { $this->nom = $nom; return $this; } /** * Get nom * * @return string */ public function getNom() { return $this->nom; } }
il faut imaginé que script n'existe plus et que dans mon formulaire il y ai url_nomconcurent1 et par magie si il y a une nouveau concurrent dans la base de donnée concurrent un input url_concurrent2 apparraisse
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57 <?php namespace noza\concurrentBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity */ class Type { /** * @ORM\GeneratedValue * @ORM\Id * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string",length=255) * @Assert\NotBlank() */ private $nom; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set nom * * @param string $nom * @return Type */ public function setNom($nom) { $this->nom = $nom; return $this; } /** * Get nom * * @return string */ public function getNom() { return $this->nom; } }
Partager