Location: PHPKode > projects > cataBlog > cataBlog-0.1-pre_alpha/0.1-pre_alpha/DataObject/Entry.php
<?php
/**
 * @license PHP
 * @author  Jackson Miller <hide@address.com>
 * @version $Id: Entry.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 entries
 * @uses PEAR::DB_DataObject
 *
 */
class CEP_DataObject_cataBlog_Entry extends DB_DataObject {

    /**
     * uses the cataBlog_entry table
     * @todo make the table configurable
     */
    private $__table='cataBlog_entry';     
    
    /**
     * cataBlog_Entry objects have the following properties
     */
    public $cb_entry_id;                    
    public $cb_entry_title;                 
    public $cb_entry_description;                      
    public $cb_entry_content;          
    public $cb_entry_date_created
    public $cb_entry_date_updated              
    public $cb_entry_comments_allow
    public $cep_user_id;                          
    public $cep_module_instance_name; 


  
    /**
     * Returns the table structure
     */
    public function table() {
        return array(
            'cb_entry_id'             => DB_DATAOBJECT_INT,
            'cb_entry_title'          => DB_DATAOBJECT_STR,
            'cb_entry_description'    => DB_DATAOBJECT_STR + DB_DATAOBJECT_TXT,
            'cb_entry_content'        => DB_DATAOBJECT_STR + DB_DATAOBJECT_TXT,
            'cb_entry_date_created'   => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME,
            'cb_entry_date_updated'   => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME,
            'cb_entry_comments_allow' => DB_DATAOBJECT_INT + DB_DATAOBJECT_BOOL,
            'cep_user_id'             => DB_DATAOBJECT_INT,
            'cep_module_instance_name'=> DB_DATAOBJECT_STR + DB_DATAOBJECT_TXT
        );
    }
  
    /**
     * Returns the keys of the table
     */  
    public function keys() {
        return array('entry_id');
    }
    
    /**
     * Allows for object caching
     * @todo propose a CEP_DataObject that includes default sleep behaviour
     */
    function __sleep() {
        return array(
                    'entry_id',
                    'entry_title',
                    'entry_description',
                    'entry_content',
                    'entry_date_created',
                    'entry_date_updated',
                    'entry_allow_comments',
                    'cep_user_id',
                    'cep_module_instance_name');
    }
    
    /**
     * Restores a cached object's database connection
     */
    function __wakeup() {
        $this->db =& $GLOBALS['cepDB'];
    }
}
?>
Return current item: cataBlog