blob: bc2a0c7a8e2041c055bac81519d0d762647440bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<?php
class Modeldb extends Model
{
protected $arttable;
protected $database;
/** @var \WFlywheel\Repository */
protected $artstore;
public function __construct()
{
$this->dbinit();
}
public function dbinit()
{
$this->database = new \JamesMoss\Flywheel\Config(Model::DATABASE_DIR, [
'query_class' => "\WFlywheel\Query",
'formatter' => new \WFlywheel\Formatter\JSON,
]);
$this->artstore = new \WFlywheel\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;
}
}
|