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

/**
 * The cataBlog Comment data object library extends CEP::DataObject
 */
require_once('CEP/DataObject.php');

/**
 * A library for accessing data associated with cataBlog comments
 * @uses CEP_DataObject
 *
 */
class CEP_DataObject_cataBlog_Comment extends CEP_DataObject {

    /**
     * uses the cataBlog_entry table
     * @todo make the table configurable
     */
    private $__table='cataBlog_comment';     
    
    /**
     * cataBlog_Entry objects have the following properties
     */
    public $cb_comment_id;                    
    public $cb_comment_title;                                       
    public $cb_comment_content;          
    public $cb_comment_date_created;
    public $cb_comment_date_updated;
    public $cb_comment_name;
    public $cb_comment_email;
    public $cb_comment_url;
    public $cep_user_id;                          
    public $cep_module_instance_name; 


  
    /**
     * Returns the table structure
     */
    public function table() {
        return array(
            'cb_comment_id'             => DB_DATAOBJECT_INT,
            'cb_comment_title'          => DB_DATAOBJECT_STR,
            'cb_comment_content'        => DB_DATAOBJECT_STR + DB_DATAOBJECT_TXT,
            'cb_comment_date_created'   => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME,
            'cb_comment_date_updated'   => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME,
            'cb_comment_name'           => DB_DATAOBJECT_STR,
            'cb_comment_email'          => DB_DATAOBJECT_STR,
            'cb_comment_url'            => DB_DATAOBJECT_STR,
            '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('cb_comment_id');
    }
    
    /**
     * Allows for object caching
     * @todo propose a CEP_DataObject that includes default sleep behaviour
     */
    function __sleep() {
        return array(
                    'cb_comment_id',
                    'cb_comment_title',
                    'cb_comment_content',
                    'cb_comment_date_created',
                    'cb_comment_date_updated',
                    'cb_comment_name',
                    'cb_comment_email',
                    'cb_comment_url',
                    'cb_entry_id',
                    'cb_parent_comment_id',
                    'cep_user_id',
                    'cep_module_instance_name');
    }
    
    /**
     * Restores a cached object's database connection
     */
    function __wakeup() {
        $this->db =& $GLOBALS['cepDB'];
    }
}
?>
Return current item: cataBlog