|
Posted by amygdala on 04/13/07 01:38
>
> class DB_table
> {
> protected static fields;
> protected static fieldSpecs;
>
> // some __constructor etc...
>
> public function getFieldSpecs( $f )
> {
> if( isset( self::fieldSpecs[ $f ] ) )
> {
> return self::fieldSpecs[ $f ];
> }
> else
> {
> return NULL;
> }
> }
> }
>
> class User extends DB_Table
> {
> protected static fieldSpecs = array(
> 'id' => array(
> 'article' => 'a',
> 'screenname' => 'user id',
> 'type' => 'int',
> 'autoinsert' => true,
> 'autoincrement' => true,
> 'static' => true
> ),
> etc...
> );
> }
>
Oops; dollarsigns where needed of course. :-S
Navigation:
[Reply to this message]
|