mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
147 lines
3.2 KiB
PHP
147 lines
3.2 KiB
PHP
<?php
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Chill\PersonBundle\Entity\SocialWork;
|
|
|
|
use DateTimeInterface;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="chill_person_social_work_goal")
|
|
* @Serializer\DiscriminatorMap(
|
|
* typeProperty="type",
|
|
* mapping={
|
|
* "social_work_goal": Goal::class
|
|
* }
|
|
* )
|
|
*/
|
|
class Goal
|
|
{
|
|
/**
|
|
* @ORM\Column(type="datetime", nullable=true)
|
|
*/
|
|
private $desactivationDate;
|
|
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\GeneratedValue
|
|
* @ORM\Column(type="integer")
|
|
* @Serializer\Groups({"read", "docgen:read"})
|
|
*/
|
|
private ?int $id = null;
|
|
|
|
/**
|
|
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="goals")
|
|
* @ORM\JoinTable(name="chill_person_social_work_goal_result")
|
|
*/
|
|
private Collection $results;
|
|
|
|
/**
|
|
* @ORM\ManyToMany(targetEntity=SocialAction::class, mappedBy="goals")
|
|
*/
|
|
private Collection $socialActions;
|
|
|
|
/**
|
|
* @ORM\Column(type="json")
|
|
* @Serializer\Groups({"read", "docgen:read"})
|
|
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
|
*/
|
|
private array $title = [];
|
|
|
|
public function __construct()
|
|
{
|
|
$this->socialActions = new ArrayCollection();
|
|
$this->results = new ArrayCollection();
|
|
}
|
|
|
|
public function addResult(Result $result): self
|
|
{
|
|
if (!$this->results->contains($result)) {
|
|
$this->results[] = $result;
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function addSocialAction(SocialAction $socialAction): self
|
|
{
|
|
if (!$this->socialActions->contains($socialAction)) {
|
|
$this->socialActions[] = $socialAction;
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDesactivationDate(): ?DateTimeInterface
|
|
{
|
|
return $this->desactivationDate;
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* @return Collection|Result[]
|
|
*/
|
|
public function getResults(): Collection
|
|
{
|
|
return $this->results;
|
|
}
|
|
|
|
/**
|
|
* @return Collection|SocialAction[]
|
|
*/
|
|
public function getSocialActions(): Collection
|
|
{
|
|
return $this->socialActions;
|
|
}
|
|
|
|
public function getTitle(): array
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
public function removeResult(Result $result): self
|
|
{
|
|
$this->results->removeElement($result);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeSocialAction(SocialAction $socialAction): self
|
|
{
|
|
$this->socialActions->removeElement($socialAction);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setDesactivationDate(?DateTimeInterface $desactivationDate): self
|
|
{
|
|
$this->desactivationDate = $desactivationDate;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setTitle(array $title): self
|
|
{
|
|
$this->title = $title;
|
|
|
|
return $this;
|
|
}
|
|
}
|