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

Paul M Jones pmjones at ciaweb.net
Thu Feb 8 12:19:23 PST 2007


On Feb 8, 2007, at 2:12 PM, Jeff Surgeson wrote:

> 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',
>         );

Aside from the fact that it will be $this->_table_cols instead of  
$this->_col, that looks right.

Some notes:

* The new Model system examines the database and gets its column  
definitions from there, if you don't have $this->_table_cols defined.

* Data filtering no longer goes in the column definition; instead,  
you will have $this->_filters['colname'][] = 'validateThis' or  
'sanitizeThat'.

And of course, it's not anywhere near ready for production, only for  
playing with.




--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.  <http://solarphp.com>

Join the Solar community wiki!  <http://solarphp.org>

Savant: The simple, elegant, and powerful solution for
templates in PHP.  <http://phpsavant.com>




More information about the solar-talk mailing list