qui sotto una implementazione della classe per gestire un ipotetico campo iva

Codice PHP:
class taxcodeModel extends entity {

    protected 
$table 'taxcodes';
    protected 
$fields = array( 'id''uid''code''description''amount''fulldescription',
        
'msg''options''taxcode''taxcodebycode''taxcodes' );

    public function 
getTaxcode() {
        
$selectQuery "SELECT * FROM " $this->table " WHERE id = :id LIMIT 0,1";
        if ( 
$this->id ) {
            
$sql $this->pdo->prepare$selectQuery );
            if ( 
$sql->execute( array( ':id'=>$this->id ) ) ) {
                return 
$sql->fetchPDO::FETCH_OBJ );
            }
            } else {
            
$this->msg "Devi impostare un ID di selezione.";
        }
    }

    public function 
getTaxcodebycode() {
        
$selectQuery "SELECT * FROM " $this->table " WHERE uid = :uid AND code = :code LIMIT 0,1";
        if ( 
$this->uid ) {
            if ( 
$this->code ) {
                
$sql $this->pdo->prepare$selectQuery );
                if ( 
$sql->execute( array( ':uid'=>$this->uid':code'=>$this->code ) ) ) {
                    return 
$sql->fetchPDO::FETCH_OBJ );
                }
                } else {
                
$this->msg "Devi impostare un CODE di selezione!";
            }
            } else {
            
$this->msg "Devi impostare un UID di selezione!";
        }
    }

    public function 
getTaxcodes() {
        
$selectQuery "SELECT * FROM " $this->table;
        if ( 
$this->options != '' ) {
            
$selectQuery .= ' ' $this->options;
        }
        
$sql $this->pdo->prepare$selectQuery );
        if ( 
$sql->execute$input ) ) {
            
$rows = array();
            while ( 
$row $sql->fetchPDO::FETCH_OBJ ) ) {
                
$rows[] = $row;
            }
            return 
$rows;
        }
    }

    public function 
insert() {
$insertQuery = <<<QUERY
INSERT INTO
  
$this->table
(id, uid, code, description, amount, fulldescription)
VALUES
  (:id, :uid, :code, :description, :amount, :fulldescription)
QUERY;
        if ( 
$this->uid ) {
            
$fields = array(
                
':id'=>uniqid(),
                
':uid'=>$this->uid,
                
':code'=>'',
                
':description'=>'',
                
':amount'=>'',
                
':fulldescription'=>''
            
);
            foreach ( 
$_POST AS $field=>$value ) {
                if ( 
array_key_exists':'.$field$fields ) ) {
                    
$fields[':'.$field] = $value;
                }
            }
            
$sql $this->pdo->prepare$insertQuery );
            if ( 
$sql->execute$fields ) ) {
                
$this->msg['msg'] = "Taxcode creata con successo!";
                
$this->msg['err'][] = "...";
                } else {
                throw new 
PDOException__CLASS__ ': Valori di input errati, nessuna riga inserita' );
            }
            } else {
            
$this->msg "Devi impostare un UID!";
        }
    }