/** * Loads SnapshotData from simple xml object * * @param \SimpleXMLElement $v * @return SnapshotData Returns SnapshotData */ protected function _loadSnapshotData(\SimpleXMLElement $v) { $item = null; if ($this->exist($v)) { $snapshotId = (string) $v->snapshotId; $item = $this->ec2->getEntityManagerEnabled() ? $this->ec2->snapshot->get($snapshotId) : null; if ($item === null) { $item = new SnapshotData(); $item->setEc2($this->ec2); $bAttach = true; } else { $item->resetObject(); $bAttach = false; } $item->snapshotId = $snapshotId; $item->volumeId = (string) $v->volumeId; $item->volumeSize = (string) $v->volumeSize; $item->ownerId = (string) $v->ownerId; $item->progress = (string) $v->progress; $item->status = (string) $v->status; $item->startTime = new DateTime((string) $v->startTime, new DateTimeZone('UTC')); $item->description = $this->exist($v->description) ? (string) $v->description : null; $item->ownerAlias = $this->exist($v->ownerAlias) ? (string) $v->ownerAlias : null; $item->encrypted = $this->exist($v->encrypted) ? (string) $v->encrypted == 'true' : null; $item->setTagSet($this->_loadResourceTagSetList($v->tagSet)); if ($bAttach && $this->ec2->getEntityManagerEnabled()) { $this->getEntityManager()->attach($item); } } return $item; }