Is it possible to extend Models somehow like:
class BaseModel extends Phalcon\Mvc\Model{
public $id,$name1;
public function getSource (){
return "base";
}
public function columnMap(){
return array(
"id" => "id",
"name" => "name1"
);
}
}
class ExtendedModel extends BaseModel{
public $id,$baseModelId,$name2;
public function getSource (){
return "normal_model";
}
public function columnMap(){
return array(
"id" => "id",
"name" => "name2",
"baseModelId" => "baseModelId"
);
}
}
$models = ExtendedModel::query()
->leftJoin("BaseModel","BaseModel.id = ExtendedModel.baseModelId")
->where("ExtendedModel.id < 12")
->execute();
foreach($models as $medium){
var_dump($medium->toArray());
}