1 | <?php |
||
23 | class Lookup extends ActiveRecord |
||
24 | { |
||
25 | private static $_items = []; |
||
26 | |||
27 | /** |
||
28 | * @inheritdoc |
||
29 | */ |
||
30 | 6 | public static function tableName() |
|
34 | |||
35 | 6 | public function behaviors() |
|
41 | |||
42 | /** |
||
43 | * @inheritdoc |
||
44 | */ |
||
45 | 4 | public function rules() |
|
55 | |||
56 | /** |
||
57 | * @inheritdoc |
||
58 | */ |
||
59 | 1 | public function attributeLabels() |
|
73 | |||
74 | /** |
||
75 | * Returns the items for the specified type. |
||
76 | * @param string item type (e.g. 'PostStatus'). |
||
77 | * @return array item names indexed by item code. The items are order by their order values. |
||
78 | * An empty array is returned if the item type does not exist. |
||
79 | */ |
||
80 | 1 | public static function items($type) |
|
87 | |||
88 | /** |
||
89 | * Returns the item name for the specified type and code. |
||
90 | * @param string the item type (e.g. 'PostStatus'). |
||
91 | * @param integer the item code (corresponding to the 'code' column value) |
||
92 | * @return string the item name for the specified the code. False is returned if the item type or code does not exist. |
||
93 | */ |
||
94 | 1 | public static function item($type, $code) |
|
101 | |||
102 | /** |
||
103 | * Loads the lookup items for the specified type from the database. |
||
104 | * @param string the item type |
||
105 | */ |
||
106 | 2 | private static function loadItems($type) |
|
121 | } |
||
122 |