updated state, now contains the value of each pin of a chip (#id_chip and no more #id_pin_merge)
This commit is contained in:
parent
0945b7da1b
commit
6d1bfcead1
|
@ -14,22 +14,21 @@
|
|||
*
|
||||
* @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)
|
||||
* @return states<Array> Retourne les données sous forme de tableau de la forme (state, chip, pin, value)
|
||||
*
|
||||
*/
|
||||
public static function getForChip($id_chip){
|
||||
|
||||
$req = DatabaseDriver::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
|
||||
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
|
||||
]);
|
||||
$chip = Table::get('chip')
|
||||
->select('id_chip')
|
||||
->whereId($id_chip);
|
||||
|
||||
$req = Table::get('state')
|
||||
->select('state')
|
||||
->select('value')
|
||||
->join('id_chip', $chip);
|
||||
|
||||
return $req->fetchAll();
|
||||
return $req->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue