PHP Classes

File: DATA/FieldDoesntExist.php

Recommend this page to a friend!
  Classes of Martin Alterisio   DATA   DATA/FieldDoesntExist.php   Download  
File: DATA/FieldDoesntExist.php
Role: Class source
Content type: text/plain
Description: An exception thrown when trying to read a field that doesn't exist on the table.
Class: DATA
Access data stored in MySQL tables like arrays
Author: By
Last change: + anonymous access
Date: 17 years ago
Size: 1,195 bytes
 

Contents

Class file image Download
<?php
/**
 * @package DATA
 */

/**
 * An exception thrown when trying to read a field that
 * doesn't exist on the table.
 */
class DATA_FieldDoesntExist extends DATA_Exception {
   
/**
     * The table where the field wasn't found.
     * @var string
     */
   
private $table;
   
   
/**
     * The field that wasn't found.
     * @var string
     */
   
private $field;
   
   
/**
     * Default constructor.
     * @param string $table The table where the field wasn't found.
     * @param string $field The field that wasn't found.
     */
   
function __construct($table, $field) {
       
parent::__construct("Field '{$field}' doesn't exist in table '{$table}'.");
       
$this->table = $table;
       
$this->field = $field;
    }
   
   
/**
     * Returns the table where the field wasn't found.
     *
     * @return string The table where the field wasn't found.
     */
   
function getTable() {
        return
$this->table;
    }
   
   
/**
     * Returns the field that wasn't found.
     *
     * @return mixed The field that wasn't found.
     */
   
function getField() {
        return
$this->field;
    }
}
?>