Location: PHPKode > projects > cataBlog > cataBlog-0.1-pre_alpha/0.1-pre_alpha/DataObject/Category.php
<?php
/**
 * @license PHP
 * @author  Jackson Miller <hide@address.com>
 * @version $Id: Category.php,v 1.1 2004/09/13 15:23:12 jaxn Exp $
 * @package cataBlog
 */

/**
 * The cataBlog Entry data object library extends PEAR::DB_DataObject
 */
require_once('DB/DataObject.php');

/**
 * A library for accessing data associated with cataBlog categories
 * @uses PEAR::DB_DataObject
 *
 */
class CEP_Library_cataBlog_Category extends DB_DataObject {

    /**
     * uses the cataBlog_category table
     * @todo make the table configurable
     */
    private $__table='cataBlog_category';     
    
    /**
     * cataBlog_Category objects have the following properties
     */
    public $category_id;                    
    public $category_title;                 
    public $category_description;                                
    public $cep_user_id;                          


  
    /**
     * Returns the table structure
     */
    public function table() {
        return array(
            'category_id'             => DB_DATAOBJECT_INT,
            'category_title'          => DB_DATAOBJECT_STR,
            'category_description'    => DB_DATAOBJECT_STR + DB_DATAOBJECT_TXT
        );
    }
  
    /**
     * Returns the keys of the table
     */  
    public function keys() {
        return array('category_id');
    }
    
    /**
     * Allows for object caching
     * @todo propose a CEP_DataObject that includes default sleep behaviour
     */
    function __sleep() {
        return array(
                    'category_id',
                    'category_title',
                    'category_description',
                    'entry_content');
    }
    
    /**
     * Restores a cached object's database connection
     */
    function __wakeup() {
        $this->db =& $GLOBALS['cepDB'];
    }
}
?>
Return current item: cataBlog