/**
  * Get the actual hyperlink to the remote application for the given replica and dest object
  */
 public function GetApplicationUrl(DBObject $oDestObj, SynchroReplica $oReplica)
 {
     if ($this->Get('url_application') == '') {
         return '';
     }
     $aSearches = array();
     $aReplacements = array();
     foreach (MetaModel::ListAttributeDefs($this->GetTargetClass()) as $sAttCode => $oAttDef) {
         if ($oAttDef->IsScalar()) {
             $aSearches[] = '$this->' . $sAttCode . '$';
             $aReplacements[] = $oDestObj->Get($sAttCode);
         }
     }
     $aData = $oReplica->LoadExtendedDataFromTable($this->GetDataTable());
     foreach ($aData as $sColumn => $value) {
         $aSearches[] = '$replica->' . $sColumn . '$';
         $aReplacements[] = $value;
     }
     return str_replace($aSearches, $aReplacements, $this->Get('url_application'));
 }
Пример #2
0
 /**
  * Helpr to clone (in memory) an object and to apply to it the values taken from a second object
  * @param DBObject $oObjToClone
  * @param DBObject $oObjWithValues
  * @return DBObject The modified clone
  */
 protected function CopyFrom($oObjToClone, $oObjWithValues)
 {
     $oObj = MetaModel::GetObject(get_class($oObjToClone), $oObjToClone->GetKey());
     foreach (MetaModel::ListAttributeDefs(get_class($oObj)) as $sAttCode => $oAttDef) {
         if (!in_array($sAttCode, $this->aExcludedColumns) && $oAttDef->IsWritable()) {
             $oObj->Set($sAttCode, $oObjWithValues->Get($sAttCode));
         }
     }
     return $oObj;
 }