Example #1
0
 /**
  * 
  * @param type $mIdOrUUID
  * @return type
  */
 public function getEntity($mIdOrUUID)
 {
     $oEntity = null;
     if ($this->oConnection->Execute($this->oCommandCreator->getEntity($mIdOrUUID))) {
         while (false !== ($oRow = $this->oConnection->GetNextRecord())) {
             if (!isset($oEntity)) {
                 $oEntity = call_user_func($oRow->entity_type . '::createInstance', $oRow->entity_module);
             }
             if (isset($oEntity)) {
                 $oEntity->iId = (int) $oRow->entity_id;
                 $oEntity->sUUID = isset($oRow->entity_uuid) ? $oRow->entity_uuid : '';
                 if (isset($oRow->attr_name)) {
                     $mValue = $oRow->attr_value;
                     $bEncrypt = false;
                     if ($oEntity->isEncryptedAttribute($oRow->attr_type)) {
                         $bEncrypt = true;
                     }
                     $oEntity->{$oRow->attr_name} = \CAttribute::createInstance($oRow->attr_name, $mValue, $oRow->attr_type, $bEncrypt, $oEntity->iId);
                 }
             }
         }
         $this->oConnection->FreeResult();
     }
     $this->throwDbExceptionIfExist();
     return $oEntity;
 }