enforce element level hierarchy
This commit is contained in:
parent
25495b6c4d
commit
99e1ba051c
5 changed files with 80 additions and 44 deletions
|
|
@ -3,14 +3,14 @@
|
|||
namespace App\Element;
|
||||
|
||||
use App\Set\Set;
|
||||
use App\Set\SetLevel;
|
||||
|
||||
final readonly class Element
|
||||
{
|
||||
public function __construct(
|
||||
private int $id,
|
||||
private string $name,
|
||||
private string $kind,
|
||||
private Set $set,
|
||||
private SetLevel $level,
|
||||
private ?Element $parentElement,
|
||||
private int $position,
|
||||
) {}
|
||||
|
|
@ -27,12 +27,17 @@ final readonly class Element
|
|||
|
||||
public function getKind(): string
|
||||
{
|
||||
return $this->kind;
|
||||
return $this->level->getKind();
|
||||
}
|
||||
|
||||
public function getLevel(): SetLevel
|
||||
{
|
||||
return $this->level;
|
||||
}
|
||||
|
||||
public function getSet(): Set
|
||||
{
|
||||
return $this->set;
|
||||
return $this->level->getSet();
|
||||
}
|
||||
|
||||
public function getParentElement(): ?Element
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue