DBmodel/models/Test.php
2025-05-29 22:55:10 +02:00

66 lines
1.4 KiB
PHP

<?php
/*
TPsoft.org 2000-2025
file for controlers/*.php
Molestones:
2025-05-27 21:36 Created
*/
class Test extends \TPsoft\DBmodel\DBmodel {
public $tables = array(
'test' => array(
'name' => 'test',
'primary_key_name' => 'id',
'allow_attributes' => array(
'name' => 'varchar(255)',
'created' => 'datetime'
)
),
);
public function exist($primary_key = null) {
return $this->existRecord('test', $primary_key);
}
public function test($primary_key = null, $data = array()) {
return $this->record('test', $primary_key, $data);
}
public function testBy($colname, $colvalue) {
return $this->recordBy('test', $colname, $colvalue);
}
public function testSave($data = array()) {
return $this->test($this->exist($data) ? $data : null, $data);
}
public function testEmpty() {
return $this->recordEmpty('test');
}
public function testAttributes() {
return $this->typesAttributes('test');
}
public function testCount() {
return $this->count('test');
}
public function getList($search = array(), $reverse = false, $concat_or = false) {
return $this->search('test')
->where($search, $concat_or)
->order(array('id' => $reverse ? 'DESC' : 'ASC'))
->toArray();
}
public function testCombo($col_key, $col_value, $add_empty = false) {
return $this->search('test')
->toCombo($col_key, $col_value, $add_empty);
}
}
?>