xref: /plugin/struct/_test/mock/AccessTableDataNoDB.php (revision 0549dcc5bc88d4f9d923acdd09931d8d51be7097)
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
8*0549dcc5SAndreas Gohrclass AccessTableDataNoDB extends AccessTablePage
9*0549dcc5SAndreas Gohr{
10e336703dSAndreas Gohr
11e336703dSAndreas Gohr
12e336703dSAndreas Gohr    /** @noinspection PhpMissingParentConstructorInspection
13e336703dSAndreas Gohr     * @param string $table
14e336703dSAndreas Gohr     * @param string $pid
15e336703dSAndreas Gohr     * @param $ts
16e336703dSAndreas Gohr     */
17*0549dcc5SAndreas Gohr    public function __construct($table, $pid, $ts)
18*0549dcc5SAndreas Gohr    {
19e336703dSAndreas Gohr
20e336703dSAndreas Gohr        // we do intialization by parent here, because we don't need the whole database behind the class
21e336703dSAndreas Gohr        $this->schema = new SchemaNoDB($table, $ts);
22e336703dSAndreas Gohr        $this->pid = $pid;
23e336703dSAndreas Gohr        $this->ts = $ts;
24e336703dSAndreas Gohr    }
25e336703dSAndreas Gohr
26*0549dcc5SAndreas Gohr    public function buildGetDataSQL($idColumn = 'pid')
27*0549dcc5SAndreas Gohr    {
288b04ed81SAnna Dabrowska        return parent::buildGetDataSQL($idColumn);
29e336703dSAndreas Gohr    }
30e336703dSAndreas Gohr
31*0549dcc5SAndreas Gohr    public function setColumns($singles, $multis)
32*0549dcc5SAndreas Gohr    {
33e336703dSAndreas Gohr        $this->schema->columns = array();
34e336703dSAndreas Gohr        $sort = 0;
35e336703dSAndreas Gohr        foreach ($singles as $single) {
36e336703dSAndreas Gohr            $sort += 1;
37e336703dSAndreas Gohr            $this->schema->columns[] = new Column($sort, new $single(), $sort);
38e336703dSAndreas Gohr        }
39e336703dSAndreas Gohr        foreach ($multis as $multi) {
40e336703dSAndreas Gohr            $sort += 1;
41e336703dSAndreas Gohr            $this->schema->columns[] = new Column($sort, new $multi(null, null, true), $sort);
42e336703dSAndreas Gohr        }
43e336703dSAndreas Gohr    }
44daf34b99SAndreas Gohr
45*0549dcc5SAndreas Gohr    protected function getLastRevisionTimestamp()
46*0549dcc5SAndreas Gohr    {
47daf34b99SAndreas Gohr        return $this->ts;
48daf34b99SAndreas Gohr    }
49daf34b99SAndreas Gohr
50e336703dSAndreas Gohr}
51