Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorebaker280
    • CommentTimeJan 24th 2008 edited
     

    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
    • CommentTimeJan 24th 2008
     

    actually the constructor takkes some arguments:

    try adding:

    $attributes = (array)func_get_args();
    return $this->init($attributes);
    
    • CommentAuthorebaker280
    • CommentTimeJan 24th 2008
     

    Ok, now instead of:

    parent::__construct();
    

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

Add your comments
    Username Password
  • Format comments as