Added possibility to define alternative names on data structures

This can be used to find elements, based on the data returned by info providers
This commit is contained in:
Jan Böhmer 2023-07-16 22:59:46 +02:00
parent edc54aaf91
commit b74ab18a6d
11 changed files with 79 additions and 5 deletions

View file

@ -419,4 +419,34 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
return $this;
}
/**
* Returns a comma separated list of alternative names.
* @return string|null
*/
public function getAlternativeNames(): ?string
{
if ($this->alternative_names === null) {
return null;
}
//Remove trailing comma
return rtrim($this->alternative_names, ',');
}
/**
* Sets a comma separated list of alternative names.
* @return $this
*/
public function setAlternativeNames(?string $new_value): self
{
//Add a trailing comma, if not already there (makes it easier to find in the database)
if (is_string($new_value) && substr($new_value, -1) !== ',') {
$new_value .= ',';
}
$this->alternative_names = $new_value;
return $this;
}
}