adapt Thirdparty form and templates

This commit is contained in:
2021-07-19 18:47:10 +02:00
parent 3f9e215ea5
commit 587da94645
8 changed files with 234 additions and 61 deletions

View File

@@ -96,18 +96,16 @@ class ThirdParty
/**
* Contact Persons: One Institutional ThirdParty has Many Contact Persons
* @var ThirdParty
* @ORM\OneToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", mappedBy="parent")
*/
private $children;
private Collection $children;
/**
* Institutional ThirdParty: Many Contact Persons have One Institutional ThirdParty
* @var ThirdParty
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
private $parent;
private ?ThirdParty $parent;
/**
* @var ThirdPartyCivility
@@ -169,16 +167,14 @@ class ThirdParty
private $centers;
/**
* @var \DateTimeImmutable
* @ORM\Column(name="created_at", type="datetime", nullable=false)
* @ORM\Column(name="created_at", type="datetime_immutable", nullable=false)
*/
private $createdAt;
private \DateTimeImmutable $createdAt;
/**
* @var \DateTime
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
*/
private $updatedAt;
private ?\DateTime $updatedAt;
/**
* @var User
@@ -497,6 +493,11 @@ class ThirdParty
return $this;
}
public function isLeaf(): bool
{
return $this->children->count() !== 0;
}
/**
* @return Collection
*/
@@ -526,18 +527,18 @@ class ThirdParty
}
/**
* @return ThirdParty
* @return ThirdParty|null
*/
public function getParent(): ThirdParty
public function getParent(): ?ThirdParty
{
return $this->parent;
}
/**
* @param ThirdParty $parent
* @param ThirdParty|null $parent
* @return $this
*/
public function setParent(ThirdParty $parent): ThirdParty
public function setParent(?ThirdParty $parent): ThirdParty
{
$this->parent = $parent;
return $this;
@@ -598,9 +599,9 @@ class ThirdParty
}
/**
* @return \DateTime
* @return \DateTime|null
*/
public function getUpdatedAt(): \DateTime
public function getUpdatedAt(): ?\DateTime
{
return $this->updatedAt;
}
@@ -616,9 +617,9 @@ class ThirdParty
}
/**
* @return User
* @return User|null
*/
public function getUpdatedBy(): User
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}