Multiple Table ,same model

Table structure is the same, different table names, how to use the same model:

(SELECT id FROM bjincome UNION ALL SELECT id FROM sdincome) as income



60.9k

you can, but you shouldnt change model source ( table) dynamically.

Hi there you can try with inheritance for example

abstract class Base {

private $id;
private $name;

public function initialize() {
$this->setSource('same_table');
}

}

class ModelOne extends Base {
//empty model 
}

class ModelTwo extends Base {
//empty model
}