[Solar-talk] _PostCreate _autoCreate ver0.25 ver0.26?

Jeff Surgeson webdev at 3hex.com
Mon Feb 5 03:44:21 PST 2007


Hi Guys

What am I missing here, I cant seem to get Solar to auto create tables if they 
do not already exist like they used to (pre ver0.25) or get _prostCreate to 
insert some data.

I am using the same way to as I always did to load a data model, instantiate 
it etc.

class Bulldog_Model_Users extends Solar_Sql_Table {

    protected function _setup()
    {
        $this->_name = 'users';
        $this->_col['user_email'] = array(.......etc);
        $this->_col['user_pass'] = array(......etc  );
    }

    protected function _postCreate()
    {
        $user = array(
            'user_email'    => 'webdev at 3hex.com',
            'user_pass'     => md5('securepassword'),
        );
        $this->save($user);
        return true;
    }

}

and in my app..

class Bulldog_App extends Solar_Controller_Page {

    $protected $_users;

    protected function _setup()
    {
        if (! Solar::isRegistered('sql')) {
            Solar::register('sql', Solar::factory('Solar_Sql'));
        }
        if (! Solar::isRegistered('user')) {
            Solar::register('user', Solar::factory('Solar_User'));
        }
        $this->_users = Solar::factory('Bulldog_Model_Users');
    }

This used to work prior to ver0.25 but no longer works, if "users" table does 
not exist it does not auto create it as it did and then run _PostCreate to 
insert a row.
I know Paul spoke some time ago about allowing autoCreate() to be turned off 
which I think he has done now with the "create" config key however the 
default is true so it should auto create without any configuration, correct? 

What am I missing, sorry if it is obvious or has been spoken about on list or 
in change list but I cant seem to find anything and Antti seem to use it OK 
in Abovo and I think that is ver0.25 ;-)

-- 
....::::....
Jeff Surgeson
3hex WebDev


More information about the solar-talk mailing list