Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorebaker280
     

    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?

    • CommentAuthorKaste
     

    actually the constructor takkes some arguments:

    try adding:

    $attributes = (array)func_get_args();
    return $this->init($attributes);
    
    • CommentAuthorebaker280
     

    Ok, now instead of:

    parent::__construct();
    

    in my subclass constructor, I have the code you posted, and it seems happy now. Thanks!