public function createVersion($version) {
$query = $this -> pdo -> prepare(
- 'INSERT INTO versions (valeur, produit, nature) VALUES (:valeur, :produit, :nature);'
+ 'INSERT INTO versions (value, product, nature) VALUES (:value, :product, :nature);'
);
- $query -> bindValue(':valeur', $version -> getValeur());
- $query -> bindValue(':produit', $version -> getProduit());
+ $query -> bindValue(':value', $version -> getValue());
+ $query -> bindValue(':product', $version -> getProduct());
$query -> bindValue(':nature', $version -> getNature());
$query -> execute();
}
$query = $this -> pdo -> prepare(
'UPDATE versions
- SET valeur = :valeur,
- produit = :produit,
+ SET value = :value,
+ product = :product,
nature = :nature
WHERE id = :id'
);
$query -> bindValue(':id', $version -> getId());
- $query -> bindValue(':valeur', $version -> getValeur());
- $query -> bindValue(':produit', $version -> getProduit());
+ $query -> bindValue(':value', $version -> getValue());
+ $query -> bindValue(':product', $version -> getProduct());
$query -> bindValue(':nature', $version -> getNature());
$query -> execute();
}
$query -> execute();
$result = $query -> fetch(PDO::FETCH_ASSOC);
- $version = new Version($result['id'], $result['valeur'], $result['produit'], $result['nature']);
+ $version = new Version($result['id'], $result['value'], $result['product'], $result['nature']);
$query->closeCursor();
$results = $query -> fetchAll(PDO::FETCH_ASSOC);
$versions = array();
foreach ($results as $result) {
- $versions[] = new Version($result['id'], $result['valeur'], $result['produit'], $result['nature']);
+ $versions[] = new Version($result['id'], $result['value'], $result['product'], $result['nature']);
}
$query->closeCursor();
return $versions;
}
- public function findValeursOfVersionsByProduitId($produit_id) {
+ public function findValuesOfVersionsByProductId($product_id) {
- $query = $this -> pdo -> prepare('SELECT valeur FROM versions WHERE produit = :produit');
- $query -> bindValue('produit', $produit_id);
+ $query = $this -> pdo -> prepare('SELECT value FROM versions WHERE product = :product');
+ $query -> bindValue('product', $product_id);
$query -> execute();
$results = $query -> fetchAll(PDO::FETCH_ASSOC);
- $valeurs = array();
+ $values = array();
foreach ($results as $result) {
- $valeurs[] = $result['valeur'];
+ $values[] = $result['value'];
}
$query->closeCursor();
- return $valeurs;
+ return $values;
}
- public function getIdByValeurAndProduitId($valeur, $produit_id) {
+ public function getIdByValueAndProductId($value, $product_id) {
- $query = $this -> pdo -> prepare('SELECT * FROM versions WHERE valeur = :valeur AND produit = :produit');
- $query -> bindValue('valeur', $valeur);
- $query -> bindValue('produit', $produit_id);
+ $query = $this -> pdo -> prepare('SELECT * FROM versions WHERE value = :value AND product = :product');
+ $query -> bindValue('value', $value);
+ $query -> bindValue('product', $product_id);
$query -> execute();
$result = $query -> fetch(PDO::FETCH_ASSOC);
}
}
-
-?>