Пример #1
0
 public function test_render()
 {
     $collection = new Collection('test', $this->mockTypeFactory, array('is_child' => true));
     $collection->addTypeName('test');
     $collection->setRev('test:rev');
     $parent = array('id' => 'parent_id', 'children' => array(array('id' => 'child1')));
     $this->parentController->test = $collection;
     $entity = $this->parentController->createWithObject($parent);
     $this->assertEquals("<div xmlns:test=\"http://test.org/\" about=\"parent_id\"><div rev=\"test:rev\"><div about=\"child1\"></div>\n</div>\n</div>\n", $entity->render());
 }
Пример #2
0
 /**
  * Handle put request
  */
 private function _handleUpdate($data, TypeInterface $type, $subject = null)
 {
     if (null === $subject) {
         $subject = $this->jsonldDecode($data['@subject']);
     }
     $object = $this->_mapper->getBySubject($subject);
     $entity = $type->createWithObject($object);
     return $this->_storeData($data, $entity);
 }