diff --git a/php/src/controleur/UtilisateurControleur.php b/php/src/controleur/UtilisateurControleur.php
index c646767..6f13247 100755
--- a/php/src/controleur/UtilisateurControleur.php
+++ b/php/src/controleur/UtilisateurControleur.php
@@ -100,8 +100,21 @@ class UtilisateurControleur
protected function creerOffre()
{
+ /*
global $twig;
echo $twig->render('testImage.html', []);
+ /*
+ * */
+ $con = new Connection("mysql:host=localhost;dbname=dbAlica",'test','test');
+
+ $imgGw = new ImageGateway($con);
+
+ $imglist = $imgGw->getAll();
+
+ //echo $imglist[0]->getBlob();
+ // echo $imglist[0]->toString();
+
+ echo '';
}
@@ -116,12 +129,17 @@ class UtilisateurControleur
return;
}
- $con = new Connection("mysql:host=localhost;dbname=dbAlida",'test','test');
+ $con = new Connection("mysql:host=localhost;dbname=dbAlica",'test','test');
$imgGw = new ImageGateway($con);
$imgGw->insertImage($img);
+
+ //echo $img->getBlob();
+ // echo '';
+
echo "
Image inserée";
+
}
diff --git a/php/src/gateway/ImageGateway.php b/php/src/gateway/ImageGateway.php
index 09a7ae0..e1c9bf8 100644
--- a/php/src/gateway/ImageGateway.php
+++ b/php/src/gateway/ImageGateway.php
@@ -42,50 +42,6 @@ class ImageGateway
));
}
- public function updateName(int $id, string $newName)
- {
- $query = 'UPDATE Image SET nom=:new WHERE id=:i';
- $this->con->executeQuery($query, array(
- ':i' => array($id, PDO::PARAM_INT),
- ':new' => array($newName, PDO::PARAM_STR)
- ));
- }
-
- public function updateDesc(int $id, string $newDesc)
- {
- $query = 'UPDATE Image SET desc=:new WHERE id=:i';
- $this->con->executeQuery($query, array(
- ':i' => array($id, PDO::PARAM_INT),
- ':new' => array($newDesc, PDO::PARAM_STR)
- ));
- }
-
- public function updateTaille(int $id, string $newTaille)
- {
- $query = 'UPDATE Image SET taille=:new WHERE id=:i';
- $this->con->executeQuery($query, array(
- ':i' => array($id, PDO::PARAM_INT),
- ':new' => array($newTaille, PDO::PARAM_STR)
- ));
- }
-
- public function updateType(int $id, string $newType)
- {
- $query = 'UPDATE Image SET type=:new WHERE id=:i';
- $this->con->executeQuery($query, array(
- ':i' => array($id, PDO::PARAM_INT),
- ':new' => array($newType, PDO::PARAM_STR)
- ));
- }
-
- public function updateBlob(int $id, string $newBlob)
- {
- $query = 'UPDATE Image SET blob=:new WHERE id=:i';
- $this->con->executeQuery($query, array(
- ':i' => array($id, PDO::PARAM_INT),
- ':new' => array($newBlob, PDO::PARAM_STR)
- ));
- }
public function delete(int $id)
{
@@ -112,7 +68,7 @@ class ImageGateway
$res = $this->con->getResults();
$array = [];
foreach ($res as $r) {
- $array[] = new Image($r['nom'], $r['desc'], $r['taille'], $r['type'], $r['blob']);
+ $array[] = new Image($r['nom'], $r['taille'], $r['type'], $r['blob']);
}
return $array;
diff --git a/php/src/modele/Image.php b/php/src/modele/Image.php
index 3860291..43b9fe6 100644
--- a/php/src/modele/Image.php
+++ b/php/src/modele/Image.php
@@ -15,7 +15,6 @@ class Image
/**
* @param string $name
- * @param string $desc
* @param string $taille
* @param string $type
* @param string $blob
@@ -50,5 +49,9 @@ class Image
return $this->blob;
}
+ public function toString() : string {
+ return "Image : " . $this->name . " " . $this->taille . " " . $this->type . " blob " . $this->blob;
+ }
+
}
\ No newline at end of file