С версии: 27.03.2013
Автор: Vitaliy Demidov (vitaliy@scalr.com)
Наследование: extends Scalr\Service\Aws\Rds\AbstractRdsDataType
Пример #1
0
 /**
  * Loads DBSnapshotData from simple xml object
  *
  * @param   \SimpleXMLElement $sxml
  * @return  DBSnapshotData Returns DBSnapshotData
  */
 protected function _loadDBSnapshotData(\SimpleXMLElement $sxml)
 {
     $item = null;
     if ($this->exist($sxml)) {
         $dBSnapshotIdentifier = (string) $sxml->DBSnapshotIdentifier;
         $item = $this->rds->getEntityManagerEnabled() ? $this->rds->dbSnapshot->get($dBSnapshotIdentifier) : null;
         if ($item === null) {
             $item = new DBSnapshotData();
             $item->setRds($this->rds);
             $bAttach = true;
         } else {
             $item->resetObject();
             $bAttach = false;
         }
         $item->dBSnapshotIdentifier = $dBSnapshotIdentifier;
         $item->allocatedStorage = $this->exist($sxml->AllocatedStorage) ? (int) $sxml->AllocatedStorage : null;
         $item->availabilityZone = $this->exist($sxml->AvailabilityZone) ? (string) $sxml->AvailabilityZone : null;
         $item->dBInstanceIdentifier = $this->exist($sxml->DBInstanceIdentifier) ? (string) $sxml->DBInstanceIdentifier : null;
         $item->engine = $this->exist($sxml->Engine) ? (string) $sxml->Engine : null;
         $item->engineVersion = $this->exist($sxml->EngineVersion) ? (string) $sxml->EngineVersion : null;
         $item->instanceCreateTime = $this->exist($sxml->InstanceCreateTime) ? new DateTime((string) $sxml->InstanceCreateTime, new DateTimeZone('UTC')) : null;
         $item->snapshotCreateTime = $this->exist($sxml->SnapshotCreateTime) ? new DateTime((string) $sxml->SnapshotCreateTime, new DateTimeZone('UTC')) : null;
         $item->iops = $this->exist($sxml->Iops) ? (int) $sxml->Iops : null;
         $item->port = $this->exist($sxml->Port) ? (int) $sxml->Port : null;
         $item->licenseModel = $this->exist($sxml->LicenseModel) ? (string) $sxml->LicenseModel : null;
         $item->masterUsername = $this->exist($sxml->MasterUsername) ? (string) $sxml->MasterUsername : null;
         $item->snapshotType = $this->exist($sxml->SnapshotType) ? (string) $sxml->SnapshotType : null;
         $item->status = $this->exist($sxml->Status) ? (string) $sxml->Status : null;
         $item->vpcId = $this->exist($sxml->VpcId) ? (string) $sxml->VpcId : null;
         if ($bAttach && $this->rds->getEntityManagerEnabled()) {
             $this->getEntityManager()->attach($item);
         }
     }
     return $item;
 }