Bonjour,

Je fais ce post me trouvant dans une situation compliquée,
Pour le contexte : je dois développer un programme permettant d'afficher des updates sur plusieurs filiale, cependant, une update peut être affecter a plusieurs filiale ou a une seul, ça dépend de chaque update, le problème étant que lorsque que je rempli le contenu d'un update des filiale, l'affichage fonctionne sur toutes les filiales appelé mais pas forcément concernée.

Pour donner un exemple: prenons 4 filiales qu'on appellera 1,2,3 et 4, je dois faire une update pour les filiales 1 et 2 avec le contenue 'azertyuip', je rentre donc le contenu dans la bdd et pas de problème l'affichage fonctionne très bien,
maintenant imaginons que je veuille faire une deuxième update pour les filiales 2,3 et 4 avec le contenu 'contenu', les filiale trois et quatre auront aucun soucis, cependant la filiale 2 (qui doit donc afficher 2 upgrade 'azertyuip' et 'contenu') affiche bien les 2 upgrades mais les deux avec le même contenu 'azertyuip', les filiale garde donc toujours les première upgrade et je ne sais pas comment débloquer ça.

Voici les méthode en questions : méthode qui affiche l'update :
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
public function ecrireBodyCardWidget():string
    {
        $chaine = "<div class='card-body overflow-auto row'>";
        $this->widgetEvol = $this->dao_widget_evol->recupererWidgetEvol(($this->widgetEvol->getId()));
        //$this->widgetEvol =$this->dao_widget_evol->recupererIdWidgetEvol($this->widgetEvol->getCodeWidget());
        $chaine .= "<ul class='list-group col-12'>";
        $result = array_unique($this->widgetEvol->getCodeEvols());
 
        foreach ($result as $id_evo){
            $id_widget = $this->dao_widget_evol->recupererIdWidgetEvol($id_evo);
 
 
 
            $chaine .= "<li class='list-group-item'>".ucfirst($id_evo);
 
 
            $listeInfos = $this->informationManager->recupererInformationByUrAndCategorie($id_evo, $id_widget);
 
            foreach ($listeInfos as $info){
 
                if($info instanceof Information){
 
                    $texte = $this->dao_widget_evol->recupererTexteId($id_widget, $id_evo);
                    $chaine .= "<div>".$texte."</div>";
 
 
                }
 
            } 
 
 
 
 
            $chaine .= "</li>";
 
    }
 
        $chaine .= "</ul></div>";
        return $chaine;
    }
Méthode qui récupère les infos de la table dont j'ai besoin :
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
<?php
$racine = substr(DIRNAME(__FILE__),0,strpos(DIRNAME(__FILE__),'DAO'));
require_once ($racine ."configAccueil.php");
require_once (configAccueil::$Chemin['Factory']);
require_once (configAccueil::$Chemin['DAOInformation']);
require_once (configAccueil::$Chemin["Information.class"]);
require_once (configAccueil::$Chemin['MysqliException']);
require_once (configAccueil::$Chemin['Error']);
 
class DAOInformationImplMysqli implements DAOInformation {
 
    private $table, $column_id, $column_titre, $column_texte, $column_dateAjout, $column_ur, $column_categorie, $column_etat;
    private $identft;
 
    public function __construct(){
        $this->table = configAccueil::$BDD["tableWidgets_Evol"];
        $this->column_categorie = configAccueil::$BDD["tWidgets_Evol_colIdEvol"];
        $this->column_id = configAccueil::$BDD["tWidgets_Evol_colIdWidget"];
        $this->column_texte = configAccueil::$BDD["tWidgets_Evol_colContenuEvol"];
        $this->identft = $_SESSION['identft'];
    }
 
 
    public function recupererInformationByUrAndCategorie($id_evo, $id_widget)
    {
        $mysql_connect = DAOFactory::connecterBDD();
 
        $listeInformations = array();
 
        $start = microtime(true);
 
        $query = "SELECT * FROM $this->table WHERE $this->column_id = ? AND $this->column_categorie = ?";
 
        $params = array();
        $params['query'] = $query;
        $params['script'] = "DAO/Implementation/Mysqli/DAOInformationImplMysqli.recupererInformationByUrAndCategorie()";
        $params['start'] = $start;
        $params['user'] = $this->identft;
        $params['id_widget'] = $id_widget;
        $params['id_evo'] = $id_evo;
 
        if($stmt = $mysql_connect->prepare($query)){
            if($stmt->bind_param("ss", $id_widget, $id_evo)){
                if($stmt->execute()){
                    if($result = $stmt->get_result()){
                        while($row = $result->fetch_assoc()) {
                            $information = new Information();
                            $information->setId($row[$this->column_id]);
                            $information->setTexte($row[$this->column_texte]);
                            $information->setCategorie($row[$this->column_categorie]);
                            array_push($listeInformations, $information);
 
                        }
                        $result->close();
                    } else {
                        $params['erreurSQL'] = $stmt->error;
                        throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_getResult['code'], Erreur::$Mysqli_getResult['msg'], $params);
                    }
                } else {
                    $params['erreurSQL'] = $stmt->error;
                    throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_executeQuery['code'], Erreur::$Mysqli_executeQuery['msg'], $params);
                }
            } else {
                $params['erreurSQL'] = $stmt->error;
                throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_bindParams['code'], Erreur::$Mysqli_bindParams['msg'], $params);
            }
        } else {
            $params['erreurSQL'] = $mysql_connect->error;
            throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_prepare['code'], Erreur::$Mysqli_prepare['msg'], $params);
        }
 
        return $listeInformations;
    }
}
 
?>
Page qui récupére les id et le texte (le contenu) séparément :
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?php
$racine = substr(DIRNAME(__FILE__),0,strpos(DIRNAME(__FILE__),'DAO'));
require_once ($racine ."configAccueil.php");
require_once (configAccueil::$Chemin["Factory"]);
require_once (configAccueil::$Chemin["DAOWidgetEvol"]);
//require_once (configAccueil::$Chemin["tableWidgets_Evol"]);
require_once (configAccueil::$Chemin["Widget.class"]);
require_once (configAccueil::$Chemin["Evol.class"]);
require_once (configAccueil::$Chemin['MysqliException']);
require_once (configAccueil::$Chemin['Error']);
 
class DAOWidgetEvolImplMysqli implements  DAOWidgetEvol {
 
    private $table, $column_idEvol, $column_idWidget, $column_texte;
    private $identft;
 
    public function __construct(){
        $this->table = configAccueil::$BDD["tableWidgets_Evol"];
        $this->column_idEvol = configAccueil::$BDD["tWidgets_Evol_colIdEvol"];
        $this->column_idWidget = configAccueil::$BDD["tWidgets_Evol_colIdWidget"];
        $this->column_texte = configAccueil::$BDD["tWidgets_Evol_colContenuEvol"];
        $this->identft = $_SESSION['identft'];
    }
 
    /** Méthode qui récupère les id (code) des evols pour un widget de type "evol" donné
     * @param int $id_widget l'id du widget de type "evol" pour lequel on recherche les evols associées
     * @return array un tableau d'objets de type Evol::class
     * @throws MysqliException si erreur lors de l'exécution de la requête SQL
     */
    public function recupererWidgetEvol(int $id_widget):WidgetEvol
    {
        $widgeEvol = new WidgetEvol();
 
        $mysql_connect = DAOFactory::connecterBDD();
 
        $start = microtime(true);
 
        $query = "SELECT DISTINCT $this->column_idEvol FROM $this->table WHERE $this->column_idWidget = ?";
 
        $params = array();
        $params['query'] = $query;
        $params['script'] = "DAO/Implementation/Mysqli/DAOWidgetEvolImplMysqli.recupererEvols()";
        $params['start'] = $start;
        $params['user'] = $this->identft;
        $params['idWidget'] = $id_widget;
        if($stmt = $mysql_connect->prepare($query)){
            if($stmt->bind_param("i",  $id_widget)){
                if($stmt->execute()){
                    if($result = $stmt->get_result()){
                        while($row = $result->fetch_assoc()) {
                            $widgeEvol->addCodeEvol($row[$this->column_idEvol]);
                            //array_push($liste_id_actu, $row[$this->column_idEvol]);
                        }
                        $result->close();
                        $stmt->close();
                    } else {
                        $params['erreurSQL'] = $stmt->error;
                        throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], EErreur::$Mysqli_getResult['code'], Erreur::$Mysqli_getResult['msg'], $params);
                    }
                } else {
                    $params['erreurSQL'] = $stmt->error;
                    throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], EErreur::$Mysqli_executeQuery['code'], Erreur::$Mysqli_executeQuery['msg'], $params);
                }
            } else {
                $params['erreurSQL'] = $stmt->error;
                throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], EErreur::$Mysqli_bindParams['code'], Erreur::$Mysqli_bindParams['msg'], $params);
            }
        } else {
            $params['erreurSQL'] = $mysql_connect->error;
            throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], EErreur::$Mysqli_prepare['code'], Erreur::$Mysqli_prepare['msg'], $params);
        }
 
        return $widgeEvol;
    }
 
    /** Méthode qui va enregistrer une ligne dans la table de relation "widgets_Evols"
     * @param WidgetEvol $widget le widget principal enregistré dans la table "widgets"
     * @throws MysqliException si erreur lors de l'exécution de la requête SQL
     */
    public function enregistrerWidgetEvol(WidgetEvol $widget)
    {
        $mysql_connect = DAOFactory::connecterBDD();
 
        $start = microtime(true);
 
        $query = "INSERT INTO $this->table($this->column_idWidget,$this->column_idEvol) VALUES(?,?)";
 
        $params = array();
        $params['query'] = $query;
        $params['script'] = "DAO/Implementation/Mysqli/DAOWidgetEvolImplMysqli.enregistrerWidgetEvol()";
        $params['start'] = $start;
        $params['user'] = $this->identft;
 
        $id = $widget->getId();
        $id_evol = "";
 
        if($stmt = $mysql_connect->prepare($query)) {
            if($stmt->bind_param("is",  $id, $id_evol)){
                //on va enregistrer dans la table de relation, autant de paire id_widget/id_evo qu'il y a d'evols
                //dans le cas d'un widget de type evols, dans les données on a un tableau d'evol (Evol::class)
                foreach ($widget->getCodeEvols() as $id_evo)
                {
                    $params['idEvol'] = $id_evo;
 
                    $id_evol = $id_evo;
                    if(!$stmt->execute()){
                        $params['erreurSQL'] = $stmt->error;
                        throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_executeQuery['code'], Erreur::$Mysqli_executeQuery['msg'], $params);
                    }
                }
            } else {
                $params['erreurSQL'] = $stmt->error;
                throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_bindParams['code'], Erreur::$Mysqli_bindParams['msg'], $params);
            }
        } else {
            $params['erreurSQL'] = $mysql_connect->error;
            throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_prepare['code'], Erreur::$Mysqli_prepare['msg'], $params);
        }
    }
 
    /** Méthode qui va supprimer les lignes associées à l'id du widget passé en paramètre
     * @param int $idWidget l'id du widget général qui va être supprimé
     * @throws MysqliException si erreur lors de l'exécution de la requête SQL
     */
    public function supprimerWidgetsEvol(int $idWidget)
    {
        $mysql_connect = DAOFactory::connecterBDD();
 
        $start = microtime(true);
 
        $query = "DELETE FROM $this->table WHERE $this->column_idWidget = ?";
 
        $params = array();
        $params['query'] = $query;
        $params['script'] = "DAO/Implementation/Mysqli/DAOWidgetEvolImplMysqli.supprimerWidgetsEvolsAssocies()";
        $params['start'] = $start;
        $params['user'] = $this->identft;
        $params['idWidget'] = $idWidget;
 
        if($stmt = $mysql_connect->prepare($query)) {
            if($stmt->bind_param("i", $idWidget)){
                if(!$stmt->execute()){
                    $params['erreurSQL'] = $stmt->error;
                    throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_executeQuery['code'], Erreur::$Mysqli_executeQuery['msg'], $params);
                }
            } else {
                $params['erreurSQL'] = $stmt->error;
                throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_bindParams['code'], Erreur::$Mysqli_bindParams['msg'], $params);
            }
        } else {
            $params['erreurSQL'] = $mysql_connect->error;
            throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_prepare['code'], Erreur::$Mysqli_prepare['msg'], $params);
        }
    }
 
    public function recupererTexteId($id, $id_evol){
        $texte_evol = "";
        $mysql_connect = DAOFactory::connecterBDD();
 
        $start = microtime(true);
 
        $query = "SELECT DISTINCT $this->column_texte FROM $this->table WHERE $this->column_idWidget = ? AND $this->column_idEvol = ?";
 
        $params = array();
        $params['query'] = $query;
        $params['script'] = "DAO/Implementation/Mysqli/DAOEvolImplMysqli.recupererNomEvol()";
        $params['start'] = $start;
        $params['user'] = $this->identft;
        $params['id'] = $id;
        $params['id_evol'] = $id_evol;
 
        if($stmt = $mysql_connect->prepare($query)){
            if($stmt->bind_param("ss",  $id, $id_evol)){
                if($stmt->execute()){
                    if($result = $stmt->get_result()){
                        if($row = $result->fetch_assoc()) {
                            $texte_evol = $row[$this->column_texte];
                        }
                        $result->close();
                    } else {
                        $params['erreurSQL'] = $stmt->error;
                        throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_getResult['code'], Erreur::$Mysqli_getResult['msg'], $params);
                    }
                } else {
                    $params['erreurSQL'] = $stmt->error;
                    throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_executeQuery['code'], Erreur::$Mysqli_executeQuery['msg'], $params);
                }
            } else {
                $params['erreurSQL'] = $stmt->error;
                throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_bindParams['code'], Erreur::$Mysqli_bindParams['msg'], $params);
            }
        } else {
            $params['erreurSQL'] = $mysql_connect->error;
            throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_prepare['code'], Erreur::$Mysqli_prepare['msg'], $params);
        }
 
        return $texte_evol;
    }
 
    public function recupererIdWidgetEvol($id_evol){
 
        $IdWidget_evol = "";
        $mysql_connect = DAOFactory::connecterBDD();
 
        $start = microtime(true);
 
        $query = "SELECT DISTINCT $this->column_idWidget FROM $this->table WHERE $this->column_idEvol = ?";
 
        $params = array();
        $params['query'] = $query;
        $params['script'] = "DAO/Implementation/Mysqli/DAOEvolImplMysqli.recupererIdWidgetEvol()";
        $params['start'] = $start;
        $params['user'] = $this->identft;
        $params['id_evol'] = $id_evol;
 
        if($stmt = $mysql_connect->prepare($query)){
            if($stmt->bind_param("s",  $id_evol)){
                if($stmt->execute()){
                    if($result = $stmt->get_result()){
                        if($row = $result->fetch_assoc()) {
                            $IdWidget_evol = $row[$this->column_idWidget];
                        }
                        $result->close();
                    } else {
                        $params['erreurSQL'] = $stmt->error;
                        throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_getResult['code'], Erreur::$Mysqli_getResult['msg'], $params);
                    }
                } else {
                    $params['erreurSQL'] = $stmt->error;
                    throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_executeQuery['code'], Erreur::$Mysqli_executeQuery['msg'], $params);
                }
            } else {
                $params['erreurSQL'] = $stmt->error;
                throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_bindParams['code'], Erreur::$Mysqli_bindParams['msg'], $params);
            }
        } else {
            $params['erreurSQL'] = $mysql_connect->error;
            throw new MysqliException(Erreur::$Mysqli_typeErreur['execution'], Erreur::$Mysqli_prepare['code'], Erreur::$Mysqli_prepare['msg'], $params);
        }
 
        return $IdWidget_evol;
    }
}
 
 
?>
Je ne sais pas si j'ai été clair dans mes infos et si j'ai bien donner tous ce qui était nécessaire, mais s'il vous-plait, serait-il possible de m'aider sur ce probléme ?