本文整理汇总了PHP中SMWDataItem::getHash方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWDataItem::getHash方法的具体用法?PHP SMWDataItem::getHash怎么用?PHP SMWDataItem::getHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWDataItem
的用法示例。
在下文中一共展示了SMWDataItem::getHash方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkAllowedValues
/**
* Check if property is range restricted and, if so, whether the current value is allowed.
* Creates an error if the value is illegal.
*/
protected function checkAllowedValues()
{
if (!is_null($this->m_property)) {
$propertyDiWikiPage = $this->m_property->getDiWikiPage();
}
if (is_null($this->m_property) || is_null($propertyDiWikiPage) || !isset($this->m_dataitem)) {
return;
// no property known, or no data to check
}
$allowedvalues = \SMW\StoreFactory::getStore()->getPropertyValues($propertyDiWikiPage, new SMWDIProperty('_PVAL'));
if (count($allowedvalues) == 0) {
return;
}
$hash = $this->m_dataitem->getHash();
$testdv = DataValueFactory::getInstance()->newTypeIDValue($this->getTypeID());
$accept = false;
$valuestring = '';
foreach ($allowedvalues as $di) {
if ($di instanceof SMWDIBlob) {
$testdv->setUserValue($di->getString());
if ($hash === $testdv->getDataItem()->getHash()) {
$accept = true;
break;
} else {
if ($valuestring !== '') {
$valuestring .= ', ';
}
$valuestring .= $di->getString();
}
}
}
if (!$accept) {
$this->addError(wfMessage('smw_notinenum', $this->getWikiValue(), $valuestring)->inContentLanguage()->text());
}
}
示例2: getHash
/**
* Return a string that identifies the value of the object, and that can
* be used to compare different value objects.
* Possibly overwritten by subclasses (e.g. to ensure that returned
* value is normalized first)
*
* @return string
*/
public function getHash()
{
return $this->isValid() ? $this->m_dataitem->getHash() : implode("\t", $this->mErrors);
}
示例3: addPropertyObjectValue
/**
* Store a value for a property identified by its SMWDataItem object.
*
* @note There is no check whether the type of the given data item
* agrees with the type of the property. Since property types can
* change, all parts of SMW are prepared to handle mismatched data item
* types anyway.
*
* @param $property SMWDIProperty
* @param $dataItem SMWDataItem
*/
public function addPropertyObjectValue(SMWDIProperty $property, SMWDataItem $dataItem)
{
if ($property->isInverse()) {
// inverse properties cannot be used for annotation
return;
}
if (!array_key_exists($property->getKey(), $this->mPropVals)) {
$this->mPropVals[$property->getKey()] = array();
$this->mProperties[$property->getKey()] = $property;
}
if ($this->mNoDuplicates) {
$this->mPropVals[$property->getKey()][$dataItem->getHash()] = $dataItem;
} else {
$this->mPropVals[$property->getKey()][] = $dataItem;
}
if (!$property->isUserDefined()) {
if ($property->isShown()) {
$this->mHasVisibleSpecs = true;
$this->mHasVisibleProps = true;
}
} else {
$this->mHasVisibleProps = true;
}
}
示例4: addToEntityList
/**
* @since 2.4
*
* @param DataItem $dataItem
* @param DIProperty|null $property
*/
public function addToEntityList(DataItem $dataItem, DIProperty $property = null)
{
$queryID = $this->getQueryId();
if (!isset($this->entityList[$queryID])) {
$this->entityList[$queryID] = array();
}
if ($dataItem instanceof DIWikiPage) {
$this->entityList[$queryID][$dataItem->getHash()] = $dataItem;
}
}