Hi Izo thanks for your response.
I don't want to generate model file each time table is created, I want a solution with 2 generic models :
- CustomTable : model of the added table
- CustomCollumn : model of each collumn
When I need to use a table model (in forms for exemple) I want to instanciate the CustomTable model that set the source to the right value and perform a function getCollumns that give me all table collumns. The attributes of the CustomTable model will be only the table name and the display name and attributes of CustomCollumn will be name, displayName, type, fieldOptions.
I don't know if the collumnMap match to what I want to do. If it do the model will be look like this:
<?php
class CustomTable extends Phalcon\Mvc\Model
{
public $tableName;
public $displayName;
public function initialize()
{
$this->setSource($this->$tableName);
}
public function columnMap()
{
return CustomCollumn::getCollumns(); //function that build an array of collumns
}
}