mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
tp: prepare address to be managed by vue (adapt formType) + add aliases methods isChild and isParent
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user