mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Creation of entities : SocialIssue / Social Action / Result / Goal
This commit is contained in:
214
src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php
Normal file
214
src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php
Normal file
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Chill\PersonBundle\Entity\SocialWork;
|
||||
|
||||
use App\Repository\Chill\PersonBundle\Entity\SocialWork\SocialActionRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass=SocialActionRepository::class)
|
||||
* @ORM\Table(name="chill_person_social_action")
|
||||
*/
|
||||
class SocialAction
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime", nullable=true)
|
||||
*/
|
||||
private $desactivationDate;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=SocialIssue::class, inversedBy="socialActions")
|
||||
*/
|
||||
private $issue;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=SocialAction::class, inversedBy="children")
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity=SocialAction::class, mappedBy="parent")
|
||||
*/
|
||||
private $children;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="dateinterval")
|
||||
*/
|
||||
private $defaultNotificationDelay;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
private $title = [];
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity=Goal::class, inversedBy="socialActions")
|
||||
* @ORM\JoinTable(name="chill_person_social_action_goal")
|
||||
*/
|
||||
private $goals;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="socialActions")
|
||||
* @ORM\JoinTable(name="chill_person_social_action_result")
|
||||
*/
|
||||
private $results;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->children = new ArrayCollection();
|
||||
$this->goals = new ArrayCollection();
|
||||
$this->results = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDesactivationDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->desactivationDate;
|
||||
}
|
||||
|
||||
public function setDesactivationDate(?\DateTimeInterface $desactivationDate): self
|
||||
{
|
||||
$this->desactivationDate = $desactivationDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIssue(): ?SocialIssue
|
||||
{
|
||||
return $this->issue;
|
||||
}
|
||||
|
||||
public function setIssue(?SocialIssue $issue): self
|
||||
{
|
||||
$this->issue = $issue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
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 getDefaultNotificationDelay(): ?\DateInterval
|
||||
{
|
||||
return $this->defaultNotificationDelay;
|
||||
}
|
||||
|
||||
public function setDefaultNotificationDelay(\DateInterval $defaultNotificationDelay): self
|
||||
{
|
||||
$this->defaultNotificationDelay = $defaultNotificationDelay;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle(): ?array
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setTitle(array $title): self
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|Goal[]
|
||||
*/
|
||||
public function getGoals(): Collection
|
||||
{
|
||||
return $this->goals;
|
||||
}
|
||||
|
||||
public function addGoal(Goal $goal): self
|
||||
{
|
||||
if (!$this->goals->contains($goal)) {
|
||||
$this->goals[] = $goal;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeGoal(Goal $goal): self
|
||||
{
|
||||
$this->goals->removeElement($goal);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|Result[]
|
||||
*/
|
||||
public function getResults(): Collection
|
||||
{
|
||||
return $this->results;
|
||||
}
|
||||
|
||||
public function addResult(Result $result): self
|
||||
{
|
||||
if (!$this->results->contains($result)) {
|
||||
$this->results[] = $result;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeResult(Result $result): self
|
||||
{
|
||||
$this->results->removeElement($result);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user