Class: dataEntity

Attributes:
Inherits:
Implements:

Contents:

Introduction

The dataEntity is a skeleton for a single item/row that resides in a database for a particular entity type

Meta Data

authorBashkim Isai
packageOXRM

Constants

There are no constants defined for this class.

Properties

Methods

Also See

Class Syntax

In file D:\oblib-core\php\oblib\dataOXRM\dataEntity.datatype.php between lines 546 and 664.

<?php
 
    
/**
     * The dataEntity is a skeleton for a single item/row that resides in a database
     * for a particular entity type
     *
     * @author    Bashkim Isai
     * @package    OXRM
     * @see        Object [data]
     * @see        Object [dataObject]
     */

    
abstract class dataEntity extends dataObject
    
{
        
        
/**
         * The corresponding object which inherits the dataEntities class
         * controlling this entity type
         * 
         * @type    Object [typeOf dataEntities]
         */
        
        
public $_denEntities;
        
        
/**
         * The DOMXPath which allows the traversing of the entire OXRM
         * document which this dataEntities entity relates to
         * 
         * @type    Object [DOMXPath]
         */
        
        
public $_dxpOXRM;
        
        
/**
         * Receives the associated dataEntities class and data from the
         * database about this particular row/dataEntity
         * 
         * @see        Object [data]
         * @see        Object [dataOXRM]
         */
        
        
final function __construct (dataEntities &$denEntities$arrData=Array ())
        {
            
$this->_denEntities =& $denEntities;
            
$this->_dxpOXRM =& $this->_denEntities->_dxpOXRM;
            
            
parent::__construct ($this->_denEntities->___ClassOne ());
            
            
// Assign the Custom Fields/Properties
            
            
$dnoPropertyList $this->_denEntities->___PropertyList ();
            
            foreach (
$dnoPropertyList as $dnoProperty)
            {
                
$strFieldName $dnoProperty->getAttribute ('name');
                
$strFieldType $dnoProperty->getAttribute ('type');
                
                
$dnlFieldParam  $this->_dxpOXRM->Query ('./param'$dnoProperty);
                
$arrFieldParam  = Array ();
                
                foreach (
$dnlFieldParam as $dnoFieldParam)
                {
                    
$arrFieldParam [$dnoFieldParam->getAttribute ('name')] = $dnoFieldParam->getAttribute ('value');
                }
                
                
$objField $this->___Push (new $strFieldType ($strFieldNameNULL$arrFieldParam));
                
                if (isset (
$arrData [$strFieldName]))
                {
                    
$objField->___setSql ($arrData [$strFieldName]);
                }
            }
            
            if (
method_exists ($this'___construct'))
            {
                
$this->___construct ();
            }
        }
        
        
/**
         * Insert this dataEntity into the Database
         * 
         * @return    Boolean
         */
        
        
public function ___Insert ()
        {
            return 
$this->_denEntities->___Insert ($this);
        }
        
        
/**
         * Update this dataEntity in the Database
         * 
         * @return    Boolean
         */
        
        
public function ___Update ()
        {
            return 
$this->_denEntities->___Update ($this);
        }
        
        
/**
         * Pluck/Remove this dataEntity from the Database
         * 
         * @return    Boolean
         */
        
        
public function ___Pluck ()
        {
            return 
$this->_denEntities->___Pluck ($this);
        }
        
        
/**
         * Check to see if this dataEntity is Sterile
         * 
         * @return    Boolean
         */
        
        
public function ___Sterile ()
        {
            foreach (
$this as $objField)
            {
                if (!
$objField->___Sterile ())
                {
                    return 
FALSE;
                }
            }
            
            return 
TRUE;
        }
    }

?>