示例#1
0
 /**
  * @param object                               $domainObject
  * @param \Riak\Client\Core\Query\RiakObject   $riakObject
  * @param \Riak\Client\Core\Query\RiakLocation $location
  */
 public function setDomainObjectValues($domainObject, RiakObject $riakObject, RiakLocation $location)
 {
     $className = get_class($domainObject);
     $metadata = $this->metadataReader->getMetadataFor($className);
     if ($keyField = $metadata->getRiakKeyField()) {
         $this->setDomainObjectProperty($domainObject, $keyField, $location->getKey());
     }
     if ($bucketNameField = $metadata->getRiakBucketNameField()) {
         $bucketName = $location->getNamespace() ? $location->getNamespace()->getBucketName() : null;
         $this->setDomainObjectProperty($domainObject, $bucketNameField, $bucketName);
     }
     if ($bucketTypeField = $metadata->getRiakBucketTypeField()) {
         $bucketName = $location->getNamespace() ? $location->getNamespace()->getBucketType() : null;
         $this->setDomainObjectProperty($domainObject, $bucketTypeField, $bucketName);
     }
     if ($vClockField = $metadata->getRiakVClockField()) {
         $this->setDomainObjectProperty($domainObject, $vClockField, $riakObject->getVClock());
     }
     if ($lastModifiedField = $metadata->getRiakLastModifiedField()) {
         $this->setDomainObjectProperty($domainObject, $lastModifiedField, $riakObject->getLastModified());
     }
     if ($contentTypeField = $metadata->getRiakContentTypeField()) {
         $this->setDomainObjectProperty($domainObject, $contentTypeField, $riakObject->getContentType());
     }
 }