addsubtag should push to array

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
Maxence Lange 2019-07-14 19:17:55 -01:00 committed by Backportbot
parent ae67ece59c
commit 89f3df067f
1 changed files with 6 additions and 1 deletions

View File

@ -359,11 +359,16 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
* @return IIndexDocument
*/
final public function addSubTag(string $sub, string $tag): IIndexDocument {
$this->subTags[$sub] = $tag;
if (!array_key_exists($sub, $this->subTags)) {
$this->subTags[$sub] = [];
}
$this->subTags[$sub][] = $tag;
return $this;
}
/**
* Set the list of sub tags assigned to the original document.
*