本文整理汇总了PHP中SMWDataItem::newFromSerialization方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWDataItem::newFromSerialization方法的具体用法?PHP SMWDataItem::newFromSerialization怎么用?PHP SMWDataItem::newFromSerialization使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWDataItem
的用法示例。
在下文中一共展示了SMWDataItem::newFromSerialization方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newFromSerialization
/**
* Creates and returns a new SWLPropertyChange instance from a serialization.
*
* @param string|null $oldValue
* @param string|null $newValue
*
* @return SWLPropertyChange
*/
public static function newFromSerialization(SMWDIProperty $property, $oldValue, $newValue)
{
$diType = SMWDataValueFactory::getDataItemId($property->findPropertyTypeID());
//var_dump($property);
//if($diType!=7) {throw new Exception();exit;}
return new self(is_null($oldValue) ? null : SMWDataItem::newFromSerialization($diType, $oldValue), is_null($newValue) ? null : SMWDataItem::newFromSerialization($diType, $newValue));
}
示例2: newFromSerialization
/**
* Creates and returns a new SWLPropertyChange instance from a serialization.
*
* @param string|null $oldValue
* @param string|null $newValue
*
* @return SWLPropertyChange
*/
public static function newFromSerialization( SMWDIProperty $property, $oldValue, $newValue ) {
$diType = SMWDataValueFactory::getDataItemId( $property->findPropertyTypeID() );
return new self(
is_null( $oldValue ) ? null : SMWDataItem::newFromSerialization( $diType, $oldValue ),
is_null( $newValue ) ? null : SMWDataItem::newFromSerialization( $diType, $newValue )
);
}
示例3: deserialize
/**
* @see ExpElement::newFromSerialization
*/
protected static function deserialize($serialization)
{
$dataItem = null;
if (!array_key_exists('dataitem', $serialization)) {
throw new RuntimeException("The serialization format is missing a dataitem element");
}
// If it is null, isset will ignore it
if (isset($serialization['dataitem'])) {
$dataItem = DataItem::newFromSerialization($serialization['dataitem']['type'], $serialization['dataitem']['item']);
}
return $dataItem;
}
示例4: unserializeDataItem
/**
* @return DataItem
*/
protected function unserializeDataItem($property, $data, $value, $semanticData)
{
$dataItem = null;
$type = $this->getDataItemId($property);
// Verify that the current property type definition and the type of the
// property during serialization do match, throw an error value to avoid any
// exception during unserialization caused by the DataItem object due to a
// mismatch of type definitions
if ($type === $value['type']) {
$dataItem = DataItem::newFromSerialization($value['type'], $value['item']);
} else {
$dataItem = $property->getDiWikiPage();
$property = new DIProperty(DIProperty::TYPE_ERROR);
$semanticData->addError(array(new ErrorValue($type, 'type mismatch', $property->getLabel())));
}
// Check whether the current dataItem has a subobject reference
if ($dataItem->getDIType() === DataItem::TYPE_WIKIPAGE && $dataItem->getSubobjectName() !== '') {
$dataItem = $this->unserializeSubobject($data, $value['item'], new SMWContainerSemanticData($dataItem));
}
// Ensure that errors are collected from a subobject level as well and
// made available at the top
if ($dataItem instanceof DIContainer) {
$semanticData->addError($dataItem->getSemanticData()->getErrors());
}
if ($property !== null && $dataItem !== null) {
$semanticData->addPropertyObjectValue($property, $dataItem);
}
}
示例5: getExpectedDataItems
/**
* @since 2.2
*
* @return DataItem[]
*/
public function getExpectedDataItems()
{
$dataItems = array();
if (!isset($this->contents['queryresult']['dataitems'])) {
return $dataItems;
}
foreach ($this->contents['queryresult']['dataitems'] as $dataitem) {
$dataItems[] = DataItem::newFromSerialization(DataTypeRegistry::getInstance()->getDataItemId($dataitem['type']), $dataitem['value']);
}
return $dataItems;
}