First of all you might want to rethink what you are doing there, dynamically creating tables should only be necessary in very rare edge cases, so there are most probably better ways to achieve whatever you are trying to achieve with this dynamic table stuff, while also sticking to CakePHP standards.
That being said, using a generic model for this purpose should work, instantiate it using ClassRegistry::init()
and pass the appropriate table name. That would even work with only an AppModel
class being present, which is being used as a fallback by ClassRegistry::init()
.
$Model = ClassRegistry::init(array('class' => 'Wf128fe', 'table' => 'wf_128fe'));
$details = $Model->find('all');
This would create an instance of AppModel
, with Wf128fe
as Model::$name
and Model::$alias
, and wf_128fe
set for Model::$table
and Model::$useTable
.
In case you need specific methods, properties, etc, the mentioned generic model might be the way to go:
class DynamicTable extends AppModel
{
public function someMethodDoingSomethingSpecialSpecificToDynamicTables()
{
}
}
$Model = ClassRegistry::init(array('class' => 'DynamicTable', 'table' => 'wf_128fe'));
$details = $Model->find('all');