remplacement toAssoc par KD2\DB\SQLite3\getGrouped
FossilOrigin-Name: e62da476e3bd6388bc26fc18ec4c6b6bf1fa56b01b465d3b6c6cad167d4a3447
This commit is contained in:
parent
4fd56bf12d
commit
1dc7969f0d
@ -22,7 +22,7 @@ class Utils
|
||||
description,
|
||||
amount as montant
|
||||
FROM services_fees');
|
||||
return Utils::toAssoc($db->get($sql), 'id');
|
||||
return $db->getGrouped($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -37,7 +37,7 @@ class Utils
|
||||
services.label,
|
||||
services.description
|
||||
FROM services');
|
||||
return Utils::toAssoc($db->get($sql), 'id');
|
||||
return $db->getGrouped($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,7 +76,7 @@ class Utils
|
||||
$annee,
|
||||
$db->where('code', $op, $comptes)
|
||||
);
|
||||
return Utils::toAssoc($db->get($sql), 'id');
|
||||
return $db->getGrouped($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,32 +120,6 @@ class Utils
|
||||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* faire un tableau associatif avec le résultat d'une requête
|
||||
*/
|
||||
static function toAssoc($array, $nomCle)
|
||||
{
|
||||
$assoc = array();
|
||||
foreach ($array as $elem)
|
||||
{
|
||||
$ro = new \ReflectionObject($elem);
|
||||
$proprietes = $ro->getProperties();
|
||||
$obj = new \stdClass();
|
||||
foreach ($proprietes as $p)
|
||||
{
|
||||
$pname = $p->getName();
|
||||
if ($pname == $nomCle) {
|
||||
$key = $p->getValue($elem);
|
||||
}
|
||||
else {
|
||||
$obj->$pname = $p->getValue($elem);
|
||||
}
|
||||
}
|
||||
$assoc[$key] = $obj;
|
||||
}
|
||||
return $assoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return versements correspondants à l'année donnée
|
||||
* @param $annee
|
||||
|
Loading…
Reference in New Issue
Block a user