mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
update schema: an evaluation may be linked to multiple actions
This commit is contained in:
@@ -12,6 +12,8 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Entity\SocialWork;
|
||||
|
||||
use DateInterval;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
@@ -45,12 +47,13 @@ class Evaluation
|
||||
private ?DateInterval $notificationDelay = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
* @ORM\ManyToMany(
|
||||
* targetEntity=SocialAction::class,
|
||||
* inversedBy="evaluations"
|
||||
* )
|
||||
* @ORM\JoinTable(name="chill_person_social_work_evaluation_action")
|
||||
*/
|
||||
private ?SocialAction $socialAction = null;
|
||||
private Collection $socialActions;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
@@ -59,6 +62,11 @@ class Evaluation
|
||||
*/
|
||||
private array $title = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->socialActions = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getDelay(): ?DateInterval
|
||||
{
|
||||
return $this->delay;
|
||||
@@ -74,11 +82,6 @@ class Evaluation
|
||||
return $this->notificationDelay;
|
||||
}
|
||||
|
||||
public function getSocialAction(): ?SocialAction
|
||||
{
|
||||
return $this->socialAction;
|
||||
}
|
||||
|
||||
public function getTitle(): array
|
||||
{
|
||||
return $this->title;
|
||||
@@ -91,16 +94,27 @@ class Evaluation
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setNotificationDelay(DateInterval $notificationDelay): self
|
||||
public function addSocialAction(SocialAction $socialAction): self
|
||||
{
|
||||
$this->notificationDelay = $notificationDelay;
|
||||
if (!$this->socialActions->contains($socialAction)) {
|
||||
$this->socialActions->add($socialAction);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSocialAction(?SocialAction $socialAction): self
|
||||
public function removeSocialAction(SocialAction $socialAction): self
|
||||
{
|
||||
$this->socialAction = $socialAction;
|
||||
if ($this->socialActions->contains($socialAction)) {
|
||||
$this->socialActions->remove($socialAction);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setNotificationDelay(DateInterval $notificationDelay): self
|
||||
{
|
||||
$this->notificationDelay = $notificationDelay;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@@ -92,6 +92,7 @@ class SocialAction
|
||||
$this->children = new ArrayCollection();
|
||||
$this->goals = new ArrayCollection();
|
||||
$this->results = new ArrayCollection();
|
||||
$this->evaluations = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function addChild(self $child): self
|
||||
|
Reference in New Issue
Block a user