public function test_loadFromParent_no_children() { $collection = new Collection('test', $this->mockTypeFactory, array('is_child' => true)); $collection->addTypeName('test'); $parent = array('id' => 'test_id'); $this->parentController->test = $collection; $entity = $this->parentController->createWithObject($parent); $children = $entity->test->getChildren(); $this->assertEquals(1, sizeof($children)); $this->assertInstanceOf('Midgard\\CreatePHP\\Entity\\Controller', $children[0]); $this->assertEquals('', $this->mockMapper->createSubject($children[0]->getObject())); $this->assertEquals('display:none', $children[0]->getAttribute('style')); }
private function _convertToJsonld($object, EntityInterface $entity) { $jsonld = array(); $jsonld['@subject'] = $this->jsonldEncode($this->_mapper->createSubject($object)); foreach ($entity->getChildDefinitions() as $node) { if ($node instanceof PropertyInterface) { $rdf_name = $node->getProperty(); $expanded_name = $this->_expandPropertyName($rdf_name, $entity); $jsonld[$expanded_name] = $this->_mapper->getPropertyValue($object, $node); } } return $jsonld; }