In file D:\oblib-core\php\oblib\dataType\dataRelationship.datatype.php between lines 45 and 120.
<?php
/**
*
*/
class dataRelationship extends data implements dataNameValuePair
{
private $_objForeignEntity;
private $_objForeignObject;
private $_intReferenceValue;
function __construct ($strFieldName, $mixNodeValue=NULL, $arrFieldParam=Array())
{
parent::__construct ($strFieldName, $mixNodeValue, $arrFieldParam);
if (!isset ($arrFieldParam ['Relationship']))
{
throw new ExceptionCore (
'The `Relationship` parameter must be defined for a foreign entity in a dataRelationship field on object: ' .
$strNodeName
);
}
$this->_objForeignEntity = $GLOBALS ['OXRM']->Entity ($arrFieldParam ['Relationship']);
}
public function ___getValue ()
{
return $this->_intReferenceValue;
}
public function ___setValue ($strNodeValue)
{
$this->_intReferenceValue = $strNodeValue;
}
public function ___getSQL ()
{
return $this->_intReferenceValue;
}
public function ___setSQL ($strNodeValue)
{
$this->_intReferenceValue = $strNodeValue;
}
public function ___Sterile ()
{
return true;
}
function __toString ()
{
return (string) $this->___getValue ();
}
public function ___Populate ()
{
if ($this->_intReferenceValue)
{
$this->_objForeignObject = $this->_objForeignEntity->___ByPrimary ($this->_intReferenceValue)->___Render ()->___Pull (0);
}
}
public function &___Render (DOMNode $domBase=NULL)
{
$dnoElement = parent::___Render ($domBase);
if ($this->_objForeignObject !== NULL)
{
$dnoElement->appendChild ($this->_objForeignObject->___Render ($domBase));
}
else
{
$dnoElement->appendChild ($dnoElement->ownerDocument->createCDATASection ($this->_intReferenceValue));
}
return $dnoElement;
}
}
?>