xref: /plugin/struct/meta/PageColumn.php (revision d1b04e896c4b5d192246ab47bfafeb0c91d92ffc)
10561158fSAndreas Gohr<?php
20561158fSAndreas Gohr
30561158fSAndreas Gohrnamespace plugin\struct\meta;
40561158fSAndreas Gohr
50561158fSAndreas Gohruse plugin\struct\types\AbstractBaseType;
60561158fSAndreas Gohr
70561158fSAndreas Gohr/**
80561158fSAndreas Gohr * Class PageColumn
90561158fSAndreas Gohr *
100561158fSAndreas Gohr * Just like a column, but does not reference one of the col* data columns but the pid column.
110561158fSAndreas Gohr *
120561158fSAndreas Gohr * @package plugin\struct\meta
130561158fSAndreas Gohr */
140561158fSAndreas Gohrclass PageColumn extends Column {
150561158fSAndreas Gohr
160561158fSAndreas Gohr    /**
170561158fSAndreas Gohr     * PageColumn constructor.
180561158fSAndreas Gohr     *
190561158fSAndreas Gohr     * @param int $sort
200561158fSAndreas Gohr     * @param AbstractBaseType $type This should be Page or Title
210561158fSAndreas Gohr     * @param string $table
220561158fSAndreas Gohr     */
230561158fSAndreas Gohr    public function __construct($sort, AbstractBaseType $type, $table='') {
240561158fSAndreas Gohr        parent::__construct($sort, $type, 0, true, $table);
250561158fSAndreas Gohr    }
260561158fSAndreas Gohr
270561158fSAndreas Gohr    public function getColref() {
280561158fSAndreas Gohr        throw new StructException('Accessing the colref of a PageColumn makes no sense');
290561158fSAndreas Gohr    }
300561158fSAndreas Gohr
31*d1b04e89SAndreas Gohr    /**
32*d1b04e89SAndreas Gohr     * @return string
33*d1b04e89SAndreas Gohr     */
34*d1b04e89SAndreas Gohr    public function getColName() {
35*d1b04e89SAndreas Gohr        $col = 'pid';
36*d1b04e89SAndreas Gohr        if($this->table) $col = $this->table.'.'.$col;
37*d1b04e89SAndreas Gohr        return $col;
38*d1b04e89SAndreas Gohr    }
39*d1b04e89SAndreas Gohr
400561158fSAndreas Gohr}
41