2016-07-19 09:27:35 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
2016-10-18 14:03:03 +00:00
|
|
|
|
namespace database\repo;
|
|
|
|
|
use \database\core\Database;
|
|
|
|
|
use \database\core\Repo;
|
2016-10-18 17:09:47 +00:00
|
|
|
|
use \error\core\Error;
|
2016-07-19 09:27:35 +00:00
|
|
|
|
use \manager\repo\cluster as clusterRepo;
|
|
|
|
|
|
|
|
|
|
class state extends parentRepo{
|
|
|
|
|
|
|
|
|
|
protected static function table_name(){ static $table_name = 'state'; return $table_name; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* RETOURNE LES VALEURS DE CHAQUE PIN POUR CHAQUE ETAT POUR UNE PUCE EN PARTICULIER
|
|
|
|
|
*
|
|
|
|
|
* @id_chip<int> UID de la puce
|
|
|
|
|
*
|
|
|
|
|
* @return states<Array> Retourne les données sous forme de tableau de la forme (state, chip, pin, value)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public static function getForChip($id_chip){
|
|
|
|
|
|
2016-07-19 14:14:04 +00:00
|
|
|
|
$req = Database::getPDO()->prepare("SELECT s.state, pm.id_chip, GROUP_CONCAT(s.value ORDER BY pm.pin ASC) as pin_values
|
|
|
|
|
FROM state as s, pin_merge as pm
|
2016-07-19 09:27:35 +00:00
|
|
|
|
WHERE s.id_pin_merge = pm.id_pin_merge
|
|
|
|
|
AND pm.id_chip = :id_chip
|
|
|
|
|
GROUP BY s.state, pm.id_chip");
|
|
|
|
|
$req->execute([
|
|
|
|
|
':id_chip' => $id_chip
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $req->fetchAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|