/** * Returns if a certain change is present in the set of changes. * * @since 0.1 * * @param SMWDIProperty $property * @param SWLPropertyChange $change * * @return boolean */ public function hasChange(SMWDIProperty $property, SWLPropertyChange $change) { $has = false; foreach ($this->changes->getPropertyChanges($property) as $propChange) { if ($propChange->getSerialization() == $change->getSerialization()) { $has = true; break; } } return $has; }
/** * Store a value for a given property identified by its text label * (without namespace prefix). * * @param string $propertyName * @param SWLPropertyChange $change */ public function addPropertyChange($propertyName, SWLPropertyChange $change) { $propertyKey = smwfNormalTitleDBKey($propertyName); if (array_key_exists($propertyKey, $this->properties)) { $property = $this->properties[$propertyKey]; } else { if (self::$propertyPrefix == '') { global $wgContLang; self::$propertyPrefix = $wgContLang->getNsText(SMW_NS_PROPERTY) . ':'; } // explicitly use prefix to cope with things like [[Property:User:Stupid::somevalue]] $propertyDV = SMWPropertyValue::makeUserProperty(self::$propertyPrefix . $propertyName); if (!$propertyDV->isValid()) { // error, maybe illegal title text return; } $property = $propertyDV->getDataItem(); } $this->addPropertyObjectChange($property, $change); }