I have generated a model class for an existing (legacy) database table. Since the database table name does not conform to the Akelos convention (not plural), I need to call the ActiveRecord setTableName(...) function to map the model to the proper table. However, when/how do I call setTableName() in my model?
I tried:
class MyModel extends ActiveRecord {
function __construct() {
$this->setTableName('the_table');
parent::__construct();
}
}
but this seems to really break things! Any suggestions?
actually the constructor takkes some arguments:
try adding:
$attributes = (array)func_get_args();
return $this->init($attributes);
Ok, now instead of:
parent::__construct();
in my subclass constructor, I have the code you posted, and it seems happy now. Thanks!
1 to 3 of 3