PHP Classes

File: DATA/RowDoesntExist.php

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

Contents

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

/**
 * An exception thrown when trying to read a row that
 * doesn't exist on the table.
 */
class DATA_RowDoesntExist extends DATA_Exception {
   
/**
     * The table where the row wasn't found.
     * @var string
     */
   
private $table;
   
   
/**
     * The row index used.
     * @var string
     */
   
private $row;
   
   
/**
     * Default constructor.
     * @param string $table The table.
     * @param mixed $row The row index used.
     */
   
function __construct($table, $row) {
       
parent::__construct("{$table}[" . var_export($row, true) . "] doesn't exist.");
       
$this->table = $table;
       
$this->row = $row;
    }
   
   
/**
     * Returns the table where the row wasn't found.
     *
     * @return string The table where the row wasn't found.
     */
   
function getTable() {
        return
$this->table;
    }
   
   
/**
     * Returns the row index used.
     *
     * @return mixed The row index used.
     */
   
function getRow() {
        return
$this->row;
    }
}
?>