xref: /plugin/struct/_test/mock/AccessTableDataNoDB.php (revision e336703dc291ad5cc7e445616d94b67d60780b0f)
1*e336703dSAndreas Gohr<?php
2*e336703dSAndreas Gohr
3*e336703dSAndreas Gohrnamespace dokuwiki\plugin\struct\test\mock;
4*e336703dSAndreas Gohr
5*e336703dSAndreas Gohruse dokuwiki\plugin\struct\meta\Column;
6*e336703dSAndreas Gohr
7*e336703dSAndreas Gohr
8*e336703dSAndreas Gohrclass AccessTableDataNoDB extends AccessTableData {
9*e336703dSAndreas Gohr
10*e336703dSAndreas Gohr
11*e336703dSAndreas Gohr    /** @noinspection PhpMissingParentConstructorInspection
12*e336703dSAndreas Gohr     * @param string $table
13*e336703dSAndreas Gohr     * @param string $pid
14*e336703dSAndreas Gohr     * @param $ts
15*e336703dSAndreas Gohr     */
16*e336703dSAndreas Gohr    public function __construct($table, $pid, $ts) {
17*e336703dSAndreas Gohr
18*e336703dSAndreas Gohr        // we do intialization by parent here, because we don't need the whole database behind the class
19*e336703dSAndreas Gohr        $this->schema = new SchemaNoDB($table, $ts);
20*e336703dSAndreas Gohr        $this->pid = $pid;
21*e336703dSAndreas Gohr        $this->ts = $ts;
22*e336703dSAndreas Gohr    }
23*e336703dSAndreas Gohr
24*e336703dSAndreas Gohr    public function buildGetDataSQL() {
25*e336703dSAndreas Gohr        return parent::buildGetDataSQL();
26*e336703dSAndreas Gohr    }
27*e336703dSAndreas Gohr
28*e336703dSAndreas Gohr    public function setColumns($singles, $multis) {
29*e336703dSAndreas Gohr        $this->schema->columns = array();
30*e336703dSAndreas Gohr        $sort = 0;
31*e336703dSAndreas Gohr        foreach ($singles as $single) {
32*e336703dSAndreas Gohr            $sort += 1;
33*e336703dSAndreas Gohr            $this->schema->columns[] = new Column($sort, new $single(), $sort);
34*e336703dSAndreas Gohr        }
35*e336703dSAndreas Gohr        foreach ($multis as $multi) {
36*e336703dSAndreas Gohr            $sort += 1;
37*e336703dSAndreas Gohr            $this->schema->columns[] = new Column($sort, new $multi(null, null, true), $sort);
38*e336703dSAndreas Gohr        }
39*e336703dSAndreas Gohr    }
40*e336703dSAndreas Gohr}
41