tp: prepare address to be managed by vue (adapt formType) + add aliases methods isChild and isParent

This commit is contained in:
2021-09-15 11:50:03 +02:00
parent a4f446c6b9
commit 910016f722
3 changed files with 50 additions and 10 deletions

View File

@@ -152,6 +152,7 @@ class ThirdParty
private $address;
/**
* Soft-delete flag
* @var boolean
* @ORM\Column(name="active", type="boolean", options={"defaut": true})
*/
@@ -498,11 +499,28 @@ class ThirdParty
return $this;
}
/**
* Mechanism to differentiate children and parents
*/
public function isLeaf(): bool
{
return $this->children->count() !== 0;
}
/**
* isLeaf aliases
*/
public function isChild():bool
{
return $this->isLeaf();
}
public function isParent():bool
{
return !$this->isLeaf();
}
/**
* @return Collection
*/
@@ -527,7 +545,8 @@ class ThirdParty
*/
public function removeChild(ThirdParty $child): self
{
$this->categories->removeElement($child);
$this->children->removeElement($child);
$this->active = false;
return $this;
}