xref: /plugin/struct/meta/PageColumn.php (revision d1b04e896c4b5d192246ab47bfafeb0c91d92ffc)
1<?php
2
3namespace plugin\struct\meta;
4
5use plugin\struct\types\AbstractBaseType;
6
7/**
8 * Class PageColumn
9 *
10 * Just like a column, but does not reference one of the col* data columns but the pid column.
11 *
12 * @package plugin\struct\meta
13 */
14class PageColumn extends Column {
15
16    /**
17     * PageColumn constructor.
18     *
19     * @param int $sort
20     * @param AbstractBaseType $type This should be Page or Title
21     * @param string $table
22     */
23    public function __construct($sort, AbstractBaseType $type, $table='') {
24        parent::__construct($sort, $type, 0, true, $table);
25    }
26
27    public function getColref() {
28        throw new StructException('Accessing the colref of a PageColumn makes no sense');
29    }
30
31    /**
32     * @return string
33     */
34    public function getColName() {
35        $col = 'pid';
36        if($this->table) $col = $this->table.'.'.$col;
37        return $col;
38    }
39
40}
41