xref: /plugin/struct/meta/Column.php (revision 1c502704592431c9b605eb91ad8b3f133892d618)
1<?php
2
3namespace plugin\struct\meta;
4
5use plugin\struct\types\AbstractBaseType;
6
7/**
8 * Class Column
9 *
10 * This represents a single column within a schema and contains the configured BaseType as well as the
11 * column reference to the data table
12 *
13 * @package plugin\struct\meta
14 */
15class Column {
16
17    /** @var int fields are sorted by this value */
18    protected $sort;
19    /** @var AbstractBaseType the type of this column */
20    protected $type;
21    /** @var int the ID of the currently used type */
22    protected $tid;
23    /** @var int the column in the datatable. columns count from 1 */
24    protected $colref;
25    /** @var bool is this column still enabled? */
26    protected $enabled=true;
27
28    /**
29     * Column constructor.
30     * @param int $sort
31     * @param AbstractBaseType $type
32     * @param int $tid
33     * @param int $colref
34     * @param bool $enabled
35     */
36    public function __construct($sort, AbstractBaseType $type, $tid = 0, $colref=0, $enabled=true) {
37        $this->sort = (int) $sort;
38        $this->type = $type;
39        $this->tid = (int) $tid;
40        $this->colref = (int) $colref;
41        $this->enabled = (bool) $enabled;
42    }
43
44    /**
45     * @return int
46     */
47    public function getSort() {
48        return $this->sort;
49    }
50
51    /**
52     * @return int
53     */
54    public function getTid() {
55        return $this->tid;
56    }
57
58    /**
59     * @return AbstractBaseType
60     */
61    public function getType() {
62        return $this->type;
63    }
64
65    /**
66     * @return int
67     */
68    public function getColref() {
69        return $this->colref;
70    }
71
72    /**
73     * @return boolean
74     */
75    public function isEnabled() {
76        return $this->enabled;
77    }
78
79
80
81}
82