[Solar-talk] Changes afoot: a new Model class

Jeff Surgeson solar at 3hex.com
Thu Feb 8 12:12:07 PST 2007


Hi Rodrigo, Cheers

> Btw, I don't know what you mean by "same as other data models". What's
> inside Bulldog_Model_Nodes?

Sorry! I mean data model as defined prior to this new class, eg:

    protected function _setup()
    {
        // the table name
        $this->_name = 'nodes';
        
        $this->_col['area_id'] = array(
            'type'    => 'int',
            'require' => true,
            'valid'   => 'word',
        );
        
        $this->_col['name'] = array(
            'type'    => 'varchar',
            'size'    => 127,
            'valid'   => 'word',
        );
etc etc..

>
> ------------------------------------------------
>
> class Bulldog_Model_Nodes extends Solar_Sql_Model {
>     protected function _setup()
>     {
>         $this->_stack->add('Bulldog_Model_');
>     }
>
>     ... more model code...
> }
>
> class Bulldog_App_Main extends Bulldog_App {
>     public $nodes;
>     public $node;
>
>     protected function _setup()
>     {
>         parent::_setup();
>         $this->nodes = Solar::factory('Bulldog_Model_Nodes');
>     }
>
>     public function actionHome()
>     {
>         // get a single record from the model
>         $id = 1;
>         $this->node = $this->nodes->fetch($id);
>     }
> }
>
> -------------------------------
> http://tipos.com.br

-- 
...........::::::...........
Jeff Surgeson / South Africa


More information about the solar-talk mailing list