We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Multiple Table ,same model

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

(SELECT id FROM bj_income UNION ALL SELECT id FROM sd_income) as income



85.5k

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
}