public function AddDefinition(CustomAttribute $attribute) { $this->labels[] = $attribute->Label(); $this->attribute_order[$attribute->Id()] = 1; if ($attribute->UniquePerEntity()) { $this->entityDefinitions[$attribute->EntityId()][$attribute->Id()] = $attribute; $this->entityAttributes[$attribute->Id()] = 1; // Log::Debug('Adding custom attribute definition for entityId=%s, label=%s', $attribute->EntityId(), $attribute->Label()); } else { $this->definitions[$attribute->Id()] = $attribute; // Log::Debug('Adding custom attribute definition label=%s', $attribute->Label()); } }
public function __construct(IRestServer $server, CustomAttribute $attribute) { $this->id = $attribute->Id(); $this->categoryId = $attribute->Category(); $this->label = $attribute->Label(); $this->possibleValues = $attribute->PossibleValueList(); $this->regex = $attribute->Regex(); $this->required = $attribute->Required(); $this->type = $attribute->Type(); $this->sortOrder = $attribute->SortOrder(); $this->appliesToId = $attribute->EntityId(); $this->AddService($server, WebServices::AllCustomAttributes, array(WebServiceParams::AttributeCategoryId => $this->categoryId)); $this->AddService($server, WebServices::GetCustomAttribute, array(WebServiceParams::AttributeId => $this->id)); $this->AddService($server, WebServices::UpdateCustomAttribute, array(WebServiceParams::AttributeId => $this->id)); $this->AddService($server, WebServices::DeleteCustomAttribute, array(WebServiceParams::AttributeId => $this->id)); }
/** * @param CustomAttribute $attribute */ public function Update(CustomAttribute $attribute) { ServiceLocator::GetDatabase()->Execute(new UpdateAttributeCommand($attribute->Id(), $attribute->Label(), $attribute->Type(), $attribute->Category(), $attribute->Regex(), $attribute->Required(), $attribute->PossibleValues(), $attribute->SortOrder(), $attribute->EntityId())); }