Description: Micro orm like Model implementation using PDO
You can specify relations in your models
This was an afternoon project, don't use it in production
$client = new Client($dbh);
$clients = $client->all();
foreach ($clients as $row) {
print $row->nom;
}
$client = $client->find(1);
foreach ($client->comptes()->get() as $compte) {
var_dump($compte);
}
$compte = new Compte($dbh);
$compte1 = $compte->find(1);
$compte1->solde = 1000;
$compte1->save();
$account = $compte1->client()->get();
only simple query are supported : select, where, orderby all three are chainable
$client = new Client($dbh);
$result = $client->select(['nom, prenom'])
->where('nom', '=', 'dubois')
->where('prenom', "<>", 'John', 'AND')
->orderBy('nom')
->orderBy('prenom', 'DESC')
->first();
$client->getSql();
or simply count the numbe of row
$client->count();
$client = new Client($dbh);
$client->nom = "Dubois";
$client->prenom = "John";
$inserted_id = $client->save();
$client->find(1, $column = 'id');
$client->all();
$client->remove(1, $column = 'id');
$client->update($attributs[]);