public function testHydrateUri() { $nodeObject = ['term' => [['@id' => 'test-@id', 'property_id' => 'test-property_id']]]; $property = $this->getMock('Omeka\\Entity\\Property'); $entityManager = $this->getEntityManager(); $entityManager->expects($this->once())->method('getReference')->with($this->equalTo('Omeka\\Entity\\Property'), $this->equalTo($nodeObject['term'][0]['property_id']))->will($this->returnValue($property)); $this->adapter->expects($this->once())->method('getEntityManager')->will($this->returnValue($entityManager)); $hydrator = new ValueHydrator($this->adapter); $hydrator->hydrate($nodeObject, $this->resource); }
/** * {@inheritDoc} */ public function hydrate(Request $request, EntityInterface $entity, ErrorStore $errorStore) { $data = $request->getContent(); if ($this->shouldHydrate($request, 'o:is_public')) { $entity->setIsPublic($request->getValue('o:is_public', true)); } // Hydrate this resource's values. $append = $request->getOperation() === Request::UPDATE && $request->isPartial(); $valueHydrator = new ValueHydrator($this); $valueHydrator->hydrate($data, $entity, $append); // o:owner $this->hydrateOwner($request, $entity); // o:resource_class $this->hydrateResourceClass($request, $entity); // o:resource_template $this->hydrateResourceTemplate($request, $entity); }