[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/database/ -> dbobject.class.php (source)

   1  <?php    
   2      
   3      /**
   4       * \ingroup Database
   5       * 
   6       * The DbObject is the object that ideally all object representing one database row should
   7       * extend. It doesn't provide too many features yet but it is planned to provide them in the
   8       * future.
   9       */
  10      class DbObject
  11      {
  12          var $_table;
  13          var $_pk;
  14          var $_class;
  15          var $_fields;
  16          var $_properties;
  17          var $unserializable;
  18      
  19      	function DbObject()
  20          {                    
  21              $this->_table = null;
  22              $this->_pk = null;
  23              $this->_class = "DbObject";
  24              $this->_fields = Array();
  25              $this->_properties = Array();
  26              $this->unserializable = Array();
  27          }
  28          
  29      	function setValue( $key, $value )
  30          {
  31              $this->_properties["$key"] = $value;
  32          }
  33          
  34      	function getValue( $key )
  35          {
  36              return( $this->_properties["$key"] );
  37          }
  38          
  39      	function setProperties( $properties )
  40          {
  41              $this->_properties = $properties;
  42          }
  43          
  44      	function getProperties()
  45          {
  46              return( $this->_properties );
  47          }
  48          
  49      	function getClass()
  50          {
  51              return( $this->_class );
  52          }
  53          
  54      	function getPK()
  55          {
  56              return( $this->_pk );
  57          }
  58          
  59      	function getFields()
  60          {
  61              return( array_keys( $this->_fields ));
  62          }
  63          
  64      	function getFieldGetters()
  65          {
  66              return( $this->_fields );
  67          }
  68          
  69          /**
  70           * No null values are serialized to the session. If there any values in your data class
  71           * that need not be serialized to the cache, please implement your own version of __sleep,
  72           * set those attributes to null and call parent::__sleep() so that those attributes are not
  73           * serialized.
  74           *
  75           * @private
  76           */
  77  		function __sleep()
  78          {
  79              $vars = (array)$this;
  80              foreach ($vars as $key => $val) {
  81                  if (is_null($val)) {
  82                      unset($vars[$key]);
  83                  }
  84              }
  85              return( array_keys($vars));
  86          }
  87      }
  88  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics