/** * @see SpecialNewEntity::modifyEntity * * @param Entity $property * * @throws InvalidArgumentException * @return Status */ protected function modifyEntity(Entity &$property) { $status = parent::modifyEntity($property); if ($this->dataType !== '') { if (!$property instanceof Property) { throw new InvalidArgumentException('Unexpected entity type'); } if ($this->dataTypeExists()) { $property->setDataTypeId($this->dataType); } else { $status->fatal('wikibase-newproperty-invalid-datatype'); } } return $status; }
/** * @see SpecialNewEntity::modifyEntity * * @param Entity $item * * @throws InvalidArgumentException * @return Status */ protected function modifyEntity(Entity &$item) { $status = parent::modifyEntity($item); if ($this->site !== null && $this->page !== null) { if (!$item instanceof Item) { throw new InvalidArgumentException('Unexpected entity type'); } $site = $this->siteStore->getSite($this->site); if ($site === null) { $status->error('wikibase-newitem-not-recognized-siteid'); return $status; } $page = $site->normalizePageName($this->page); if ($page === false) { $status->error('wikibase-newitem-no-external-page'); return $status; } $item->getSiteLinkList()->addNewSiteLink($site->getGlobalId(), $page); } return $status; }