mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
review: fix stuffs on socialAction and socialIssue filters:
* filters call static entity method * add renderString option to manage add_children * add tests on new entity method getDescendantsWithThisFor..() * rename function in repository * rename 'Select2..' classes by 'Pick..' and replace all occurences
This commit is contained in:
@@ -215,6 +215,23 @@ class SocialIssue
|
||||
return $descendants;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection|SocialIssue[] $socialIssues
|
||||
* @return Collection
|
||||
*/
|
||||
public static function getDescendantsWithThisForIssues(Collection $socialIssues): Collection
|
||||
{
|
||||
$unique = [];
|
||||
|
||||
foreach ($socialIssues as $issue) {
|
||||
foreach ($issue->getDescendantsWithThis() as $child) {
|
||||
$unique[spl_object_hash($child)] = $child;
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayCollection(array_values($unique));
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
@@ -267,6 +284,11 @@ class SocialIssue
|
||||
return null !== $this->parent;
|
||||
}
|
||||
|
||||
public function hasChildren(): bool
|
||||
{
|
||||
return 0 < $this->getChildren()->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive method which return true if the current $issue is a descendant
|
||||
* of the $issue given in parameter.
|
||||
|
Reference in New Issue
Block a user