accompanying period validation - on social issues suppression

This commit is contained in:
juminet
2021-12-07 17:16:13 +00:00
committed by Julien Fastré
parent 6cc0f1f98b
commit b683630136
13 changed files with 206 additions and 39 deletions

View File

@@ -121,6 +121,27 @@ class SocialIssue
return $ancestors;
}
/**
* get all the ancestors of the social issue
*
* @param bool $includeThis if the array in the result must include the present SocialIssue
*/
public function getAncestors(bool $includeThis = true): array
{
$ancestors = [];
if ($includeThis) {
$ancestors[] = $this;
}
$current = $this;
while ($current->hasParent()) {
$ancestors[] = $current = $current->getParent();
}
return $ancestors;
}
/**
* @return Collection|self[]
*/