2021-05-04 19:14:50 +02:00

155 lines
3.4 KiB
PHP

<?php
namespace Chill\PersonBundle\Entity\SocialWork;
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SocialIssueRepository::class)
* @ORM\Table(name="chill_person_social_issue")
*/
class SocialIssue
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=SocialIssue::class, inversedBy="children")
*/
private $parent;
/**
* @ORM\OneToMany(targetEntity=SocialIssue::class, mappedBy="parent")
*/
private $children;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $desactivationDate;
/**
* @ORM\Column(type="json")
*/
private $title = [];
/**
* @ORM\OneToMany(targetEntity=SocialAction::class, mappedBy="issue")
*/
private $socialActions;
public function __construct()
{
$this->children = new ArrayCollection();
$this->socialActions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getParent(): ?self
{
return $this->parent;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
return $this;
}
/**
* @return Collection|self[]
*/
public function getChildren(): Collection
{
return $this->children;
}
public function addChild(self $child): self
{
if (!$this->children->contains($child)) {
$this->children[] = $child;
$child->setParent($this);
}
return $this;
}
public function removeChild(self $child): self
{
if ($this->children->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getParent() === $this) {
$child->setParent(null);
}
}
return $this;
}
public function getDesactivationDate(): ?\DateTimeInterface
{
return $this->desactivationDate;
}
public function setDesactivationDate(?\DateTimeInterface $desactivationDate): self
{
$this->desactivationDate = $desactivationDate;
return $this;
}
public function getTitle(): array
{
return $this->title;
}
public function setTitle(array $title): self
{
$this->title = $title;
return $this;
}
/**
* @return Collection|SocialAction[]
*/
public function getSocialActions(): Collection
{
return $this->socialActions;
}
public function addSocialAction(SocialAction $socialAction): self
{
if (!$this->socialActions->contains($socialAction)) {
$this->socialActions[] = $socialAction;
$socialAction->setSocialIssue($this);
}
return $this;
}
public function removeSocialAction(SocialAction $socialAction): self
{
if ($this->socialActions->removeElement($socialAction)) {
// set the owning side to null (unless already changed)
if ($socialAction->getSocialIssue() === $this) {
$socialAction->setSocialIssue(null);
}
}
return $this;
}
}