mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-13 20:04:34 +02:00
Cache the trees structures for treeViews used in the sidebar.
This commit is contained in:
parent
9668d1084b
commit
ad69c32832
13 changed files with 653 additions and 70 deletions
|
@ -21,6 +21,10 @@
|
|||
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
|
||||
/**
|
||||
* This class represents a node for the bootstrap treeview node.
|
||||
* When you serialize an array of these objects to JSON, you can use the serialized data in data for the treeview.
|
||||
|
@ -35,6 +39,8 @@ class TreeViewNode
|
|||
|
||||
protected $tags;
|
||||
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Creates a new TreeView node with the given parameters.
|
||||
*
|
||||
|
@ -53,6 +59,28 @@ class TreeViewNode
|
|||
//$this->state = new TreeViewNodeState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ID of the entity associated with this node.
|
||||
* Null if this node is not connected with an entity.
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId() : ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ID of the entity associated with this node.
|
||||
* Null if this node is not connected with an entity.
|
||||
* @param int|null $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId(?int $id): self
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the node text.
|
||||
*
|
||||
|
@ -104,7 +132,7 @@ class TreeViewNode
|
|||
/**
|
||||
* Returns the children nodes of this node.
|
||||
*
|
||||
* @return array|null
|
||||
* @return TreeViewNode[]|null
|
||||
*/
|
||||
public function getNodes(): ?array
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue