Added a simple system for treeViews.

This commit is contained in:
Jan Böhmer 2019-03-24 15:25:40 +01:00
parent 22c836096e
commit 715de5b67c
13 changed files with 509 additions and 33 deletions

View file

@ -37,6 +37,7 @@ use Doctrine\ORM\PersistentCollection;
* an attribute of a root element, you will get an exception!
*
* @ORM\MappedSuperclass()
* //@ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
*/
abstract class StructuralDBElement extends AttachmentContainingDBElement
{
@ -207,23 +208,9 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
*
* @return static[] all subelements as an array of objects (sorted by their full path)
*/
public function getSubelements(bool $recursive): PersistentCollection
public function getSubelements(): PersistentCollection
{
if (null == $this->children) {
$this->children = new ArrayCollection();
}
if (!$recursive) {
return $this->children;
}
$all_elements = array();
foreach ($this->children as $subelement) {
$all_elements[] = $subelement;
$all_elements = array_merge($all_elements, $subelement->getSubelements(true));
}
return $all_elements;
return $this->children;
}
/******************************************************************************