mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Merge branch 'master' into 327_pinned_comment
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,20 @@ class Evaluation
|
||||
*/
|
||||
private array $title = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->socialActions = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function addSocialAction(SocialAction $socialAction): self
|
||||
{
|
||||
if (!$this->socialActions->contains($socialAction)) {
|
||||
$this->socialActions->add($socialAction);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDelay(): ?DateInterval
|
||||
{
|
||||
return $this->delay;
|
||||
@@ -74,16 +91,20 @@ class Evaluation
|
||||
return $this->notificationDelay;
|
||||
}
|
||||
|
||||
public function getSocialAction(): ?SocialAction
|
||||
{
|
||||
return $this->socialAction;
|
||||
}
|
||||
|
||||
public function getTitle(): array
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function removeSocialAction(SocialAction $socialAction): self
|
||||
{
|
||||
if ($this->socialActions->contains($socialAction)) {
|
||||
$this->socialActions->remove($socialAction);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDelay(DateInterval $delay): self
|
||||
{
|
||||
$this->delay = $delay;
|
||||
@@ -98,13 +119,6 @@ class Evaluation
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSocialAction(?SocialAction $socialAction): self
|
||||
{
|
||||
$this->socialAction = $socialAction;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTitle(array $title): self
|
||||
{
|
||||
$this->title = $title;
|
||||
|
@@ -46,9 +46,9 @@ class SocialAction
|
||||
private $desactivationDate;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(
|
||||
* @ORM\ManyToMany(
|
||||
* targetEntity=Evaluation::class,
|
||||
* mappedBy="socialAction"
|
||||
* mappedBy="socialActions"
|
||||
* )
|
||||
*/
|
||||
private Collection $evaluations;
|
||||
@@ -71,6 +71,11 @@ class SocialAction
|
||||
*/
|
||||
private $issue;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="float", name="ordering", options={"default": 0.0})
|
||||
*/
|
||||
private float $ordering = 0.0;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=SocialAction::class, inversedBy="children")
|
||||
*/
|
||||
@@ -92,13 +97,14 @@ class SocialAction
|
||||
$this->children = new ArrayCollection();
|
||||
$this->goals = new ArrayCollection();
|
||||
$this->results = new ArrayCollection();
|
||||
$this->evaluations = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function addChild(self $child): self
|
||||
{
|
||||
if (!$this->children->contains($child)) {
|
||||
$this->children[] = $child;
|
||||
$child->setParent($this);
|
||||
$child->setParent($this)->setIssue($this->getIssue());
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -199,6 +205,11 @@ class SocialAction
|
||||
return $this->issue;
|
||||
}
|
||||
|
||||
public function getOrdering(): float
|
||||
{
|
||||
return $this->ordering;
|
||||
}
|
||||
|
||||
public function getParent(): ?self
|
||||
{
|
||||
return $this->parent;
|
||||
@@ -266,9 +277,23 @@ class SocialAction
|
||||
{
|
||||
$this->issue = $issue;
|
||||
|
||||
foreach ($this->getChildren() as $child) {
|
||||
$child->setIssue($issue);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setOrdering(float $ordering): SocialAction
|
||||
{
|
||||
$this->ordering = $ordering;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal use $parent->addChild() instead (@see{self::addChild()})
|
||||
*/
|
||||
public function setParent(?self $parent): self
|
||||
{
|
||||
$this->parent = $parent;
|
||||
|
@@ -44,6 +44,11 @@ class SocialIssue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="float", name="ordering", options={"default": 0.0})
|
||||
*/
|
||||
private float $ordering = 0.0;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=SocialIssue::class, inversedBy="children")
|
||||
*/
|
||||
@@ -215,6 +220,11 @@ class SocialIssue
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getOrdering(): float
|
||||
{
|
||||
return $this->ordering;
|
||||
}
|
||||
|
||||
public function getParent(): ?self
|
||||
{
|
||||
return $this->parent;
|
||||
@@ -305,6 +315,16 @@ class SocialIssue
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setOrdering(float $ordering): SocialIssue
|
||||
{
|
||||
$this->ordering = $ordering;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal use @see{SocialIssue::addChild()} instead
|
||||
*/
|
||||
public function setParent(?self $parent): self
|
||||
{
|
||||
$this->parent = $parent;
|
||||
|
Reference in New Issue
Block a user