<?php
/**
 * db.plainitem.class
 *
 * DB Plain Item
 *
 * @version:    0.1a
 * @package:    flame.core
 * @author:    alex <qfox@ya.ru> yaroshevich
 * @created:    28 nov 2007
 * @link:    http://src.qfox.ru/
 * 
 * @copyright:    (c) 2007 flamebox. All rights reserved.
 */

/** standart verifying */
if( !defined'FLAMECMS' ) ) return;


if( 
defined'__DB_PLAINITEM_CLASS_PHP' ) ) return;
define'__DB_PLAINITEM_CLASS_PHP''0.1' );

class 
fbDBPlainItem
{
    var 
$_table '';
    var 
$_fields null;
    var 
$_keys null;
    var 
$_id 0;
    var 
$_data null;
    
    function 
fbDBPlainItem$_table$_id )
    {
        
$this ->_id $_id;
        
$this ->_table $_table;
        
$this ->_fields sqlTableFields$_table );
        
$this ->_keys sqlTableKeys$_table );
        
$this ->load( );
        
$this ->_id $this ->_data'id_'.sqlTNName$_table ) ];
    }
    
    function 
save( )
    {
        return 
null;
        
//sqlget( $this ->_table, $this ->_id );
    
}
    
    function 
load( )
    {
        list( 
$this ->_data ) = array_values( (array)sqlget$this ->_table$this ->_id ) );
    }
    
    function 
get( )
    {
        if( isset( 
$this ->_data ) )
            return 
$this ->_data;
        
        list( 
$_r ) = object_flat( array( $this ), '$' );
        return 
$_r;
    }
    
    function 
getId( )
    {
        return (int)
$this ->_id;
    }
    
};




?>