/** * {@inheritdoc} */ public function toDomain(RiakObjectReference $reference) { $location = $reference->getLocation(); $riakObject = $reference->getRiakObject(); $type = $reference->getDomainObjectType(); $domainObject = $this->toDomainObject($riakObject->getValue(), $type); $this->domainHydrator->setDomainObjectValues($domainObject, $riakObject, $location); return $domainObject; }
public function testHidrateDomainObject() { $riakObject = new RiakObject(); $domainObject = new SimpleObject(); $vClock = new VClock('vclock-hash'); $namespace = new RiakNamespace('type', 'bucket'); $location = new RiakLocation($namespace, 'riak-key'); $riakObject->setVClock($vClock); $riakObject->setContentType('application/json'); $riakObject->setLastModified('Sat, 01 Jan 2015 01:01:01 GMT'); $this->instance->setDomainObjectValues($domainObject, $riakObject, $location); $this->assertEquals('Sat, 01 Jan 2015 01:01:01 GMT', $domainObject->getRiakLastModified()); $this->assertEquals('application/json', $domainObject->getRiakContentType()); $this->assertEquals('bucket', $domainObject->getRiakBucketName()); $this->assertEquals('type', $domainObject->getRiakBucketType()); $this->assertEquals('riak-key', $domainObject->getRiakKey()); $this->assertEquals($vClock, $domainObject->getRiakVClock()); }