xref: /plugin/struct/_test/mock/AccessTableDataNoDB.php (revision 8b04ed8174b19d68efb6bd7e781d1086fe9750ca)
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
24*8b04ed81SAnna Dabrowska    public function buildGetDataSQL($idColumn = 'pid') {
25*8b04ed81SAnna Dabrowska        return parent::buildGetDataSQL($idColumn);
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    }
40daf34b99SAndreas Gohr
41daf34b99SAndreas Gohr    protected function getLastRevisionTimestamp() {
42daf34b99SAndreas Gohr        return $this->ts;
43daf34b99SAndreas Gohr    }
44daf34b99SAndreas Gohr
45e336703dSAndreas Gohr}
46