Exemplo n.º 1
0
 /**
  * Get reference object with given object name
  *
  * @param string $objName name of the object reference
  * @return obejct the instance of reference object
  */
 public function getRefObject($objName)
 {
     return $this->bizDataObj->getRefObject($objName);
 }
Exemplo n.º 2
0
 /**
  * Set the association of the object
  *
  * @param ObjReference $objRef
  * @param BizDataObj $asscObj
  * @return void
  */
 protected function setAssociation($objRef, $asscObj)
 {
     $this->association["AsscObjName"] = $asscObj->objectName;
     $this->association["Relationship"] = $objRef->relationship;
     $this->association["Table"] = $objRef->table;
     $this->association["Column"] = $objRef->column;
     $this->association["FieldRef"] = $objRef->fieldRef;
     $this->association["FieldRefVal"] = $asscObj->getFieldValue($objRef->fieldRef);
     $this->association["CondColumn"] = $objRef->condColumn;
     $this->association["CondValue"] = $objRef->condValue;
     $this->association["Condition"] = $objRef->condition;
     if ($objRef->relationship == "M-M" || $objRef->relationship == "Self-Self") {
         $this->association["XTable"] = $objRef->xTable;
         $this->association["XColumn1"] = $objRef->xColumn1;
         $this->association["XColumn2"] = $objRef->xColumn2;
         $this->association["XKeyColumn"] = $objRef->xKeyColumn;
         $this->association["XDataObj"] = $objRef->xDataObj;
     }
 }
Exemplo n.º 3
0
 /**
  * Pick the joined object's current record to the current record
  *
  * @param BizDataObj $joinDataObj
  * @param string $joinName name of join (optional)
  * @return array return a modified record with joined record data
  */
 public function joinRecord($joinDataObj, $joinName = "")
 {
     // get the maintable of the joindataobj
     $joinTable = $joinDataObj->mainTableName;
     $joinRecord = null;
     $returnRecord = array();
     // find the proper join according to join name and the maintable
     foreach ($this->tableJoins as $tableJoin) {
         if (($joinName == $tableJoin->objectName || $joinName == "") && $tableJoin->table == $joinTable) {
             // populate the column-fieldvalue to columnRef-fieldvalue
             // get the field mapping to the column, then get the field value
             $joinFieldName = $joinDataObj->bizRecord->getFieldByColumn($tableJoin->column);
             // joined-main table
             if (!$joinFieldName) {
                 continue;
             }
             if (!$joinRecord) {
                 $joinRecord = $joinDataObj->getActiveRecord();
             }
             $refFieldName = $this->bizRecord->getFieldByColumn($tableJoin->columnRef);
             // join table
             $returnRecord[$refFieldName] = $joinRecord[$joinFieldName];
             // populate joinRecord's field to current record
             foreach ($this->bizRecord as $fld) {
                 if ($fld->join == $tableJoin->objectName) {
                     // use join column to match joinRecord field's column
                     $jfldname = $joinDataObj->bizRecord->getFieldByColumn($fld->column);
                     // joined-main table
                     $returnRecord[$fld->objectName] = $joinRecord[$jfldname];
                 }
             }
             break;
         }
     }
     // return a modified record with joined record data
     return $returnRecord;
 }