diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2018-11-11 17:19:26 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2018-11-11 17:19:26 +0100 |
commit | d7f3313ff4514e38c9f53439cd1a1287e56e45f7 (patch) | |
tree | abff39ab11cb317f5fcd2db558da1c59bdae9239 /app/class/modeldb.php | |
parent | 2f363e8fa26ab849539e64ff7caa21bd164e8979 (diff) | |
download | wcms-d7f3313ff4514e38c9f53439cd1a1287e56e45f7.tar.gz wcms-d7f3313ff4514e38c9f53439cd1a1287e56e45f7.zip |
reboot folder
Diffstat (limited to 'app/class/modeldb.php')
-rw-r--r-- | app/class/modeldb.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/app/class/modeldb.php b/app/class/modeldb.php new file mode 100644 index 0000000..a5ebf6f --- /dev/null +++ b/app/class/modeldb.php @@ -0,0 +1,54 @@ +<?php +class Modeldb extends Model +{ + /** @var PDO */ + protected $bdd; + protected $arttable; + protected $database; + protected $artstore; + + + public function __construct() + { + $this->dbinit(); + } + + + public function dbinit() + { + $this->database = new \JamesMoss\Flywheel\Config(__DIR__ .'/../../w_database'); + $this->artstore = new \JamesMoss\Flywheel\Repository(Config::arttable(), $this->database); + } + + + public function getlister() + { + $artlist = []; + $list = $this->artstore->findAll(); + foreach ($list as $artdata) { + $artlist[$artdata->id] = new Art2($artdata); + } + return $artlist; + } + + public function list() + { + return $this->artstore->getAllIds(); + } + + public function getlisterid(array $idlist = []) + { + $artdatalist = $this->artstore->query() + ->where('__id', 'IN', $idlist) + ->execute(); + + $artlist = []; + foreach ($artdatalist as $id => $artdata) { + $artlist[$id] = new Art2($artdata); + } + return $artlist; + } + + + +} |