public function testIri() { $this->assertNull($this->attributeMetadata->getIri()); $newAttributeMetadata = $this->attributeMetadata->withIri('https://les-tilleuls.coop'); $this->assertEquals('https://les-tilleuls.coop', $newAttributeMetadata->getIri()); $this->assertNotEquals($this->attributeMetadata, $newAttributeMetadata); }
/** * @param AttributeMetadata $attribute * @param $entityName * @param $type * @return array|null|string */ protected function addAttribute(AttributeMetadata $attribute, $entityName, $type) { if ($type === 'context') { if (!($id = $attribute->getIri())) { $prefixedShortName = sprintf('#%s', $entityName); $id = sprintf('%s/%s', $prefixedShortName, $attribute->getName()); } return $id; } $propertyInfo = array_shift($attribute->getTypes()); $type = $propertyInfo->getType(); return ['dataType' => $type, 'actualType' => $type, 'subType' => null, 'required' => $attribute->isRequired(), 'default' => null, 'description' => $attribute->getDescription(), 'readonly' => !$attribute->isWritable(), 'sinceVersion' => null, 'untilVersion' => null]; }