add element child list
This commit is contained in:
parent
aa746fe3f0
commit
7350d747f3
9 changed files with 186 additions and 10 deletions
|
|
@ -66,6 +66,25 @@ class FakeElementRepository implements ElementRepository
|
|||
return $elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Element[]
|
||||
*/
|
||||
public function findByParentElement(Element $parentElement): array
|
||||
{
|
||||
$elements = [];
|
||||
foreach ($this->elementsById as $element) {
|
||||
$currentParentElement = $element->getParentElement();
|
||||
if (
|
||||
$currentParentElement !== null
|
||||
&& $currentParentElement->getId() === $parentElement->getId()
|
||||
) {
|
||||
$elements[] = $this->cloneElement($element);
|
||||
}
|
||||
}
|
||||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
private function cloneElement(Element $element): Element
|
||||
{
|
||||
$parentElement = $element->getParentElement();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue