Skip to content
Snippets Groups Projects
Commit dbc672c4 authored by clement's avatar clement
Browse files

getAll

parent e2acf7d2
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,18 @@ class Objet
public static function getAll()
{
// TODO return list of objects Client
echo "toto:".get_called_class();
return Array();
$dbName = lcfirst(get_called_class());
$bdd = new Db();
$result = Array();
$requete_prepare = $bdd->db->prepare("SELECT * FROM :table"); // on prépare notre requête
$requete_prepare->execute(array( 'table' => $dbName ));
while($ligne = $requete_prepare->fetch(PDO::FETCH_ASSOC)) {
$temp = new get_called_class()();
$temp->fromDb($ligne);
$result[] = $temp;
}
return $result;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment