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