/** * Create a value for a data item. * * @param $dataItem DataItem * @param $property mixed null or SMWDIProperty property object for which this value is made * @param $caption mixed user-defined caption, or false if none given * * @return DataValue */ public function newDataValueByItem(DataItem $dataItem, DIProperty $property = null, $caption = false) { if ($property !== null) { $typeId = $property->findPropertyTypeID(); } else { $typeId = $this->dataTypeRegistry->getDefaultDataItemTypeId($dataItem->getDiType()); } $dataValue = $this->newDataValueByType($typeId, false, $caption, $property); $dataValue->setDataItem($dataItem); if ($caption !== false) { $dataValue->setCaption($caption); } return $dataValue; }