public function UpdateAttribute() { $attributeId = $this->page->GetAttributeId(); $attributeName = $this->page->GetLabel(); $regex = $this->page->GetValidationExpression(); $required = $this->page->GetIsRequired(); $possibleValues = $this->page->GetPossibleValues(); $sortOrder = $this->page->GetSortOrder(); $entityId = $this->page->GetEntityId(); Log::Debug('Updating attribute with id: %s', $attributeId); $attribute = $this->attributeRepository->LoadById($attributeId); $attribute->Update($attributeName, $regex, $required, $possibleValues, $sortOrder, $entityId); $this->attributeRepository->Update($attribute); }
/** * @param int $attributeId * @param CustomAttributeRequest $request * @param WebServiceUserSession $session * @return AttributeControllerResult */ public function Update($attributeId, $request, $session) { $errors = $this->ValidateRequest($request); if (empty($attributeId)) { $errors[] = 'attributeId is required'; } if (!empty($errors)) { return new AttributeControllerResult(null, $errors); } $attribute = new CustomAttribute($attributeId, $request->label, $request->type, $request->categoryId, $request->regex, $request->required, $request->possibleValues, $request->sortOrder, $request->appliesToId); $this->repository->Update($attribute); return new AttributeControllerResult($attributeId, null); }