mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
add api for getting goal and results by social action and goal
This commit is contained in:
@@ -7,10 +7,17 @@ use Chill\PersonBundle\Entity\SocialWork\Result;
|
||||
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_accompanying_period_work_goal")
|
||||
* @Serializer\DiscriminatorMap(
|
||||
* typeProperty="type",
|
||||
* mapping={
|
||||
* "accompanying_period_work_goal":AccompanyingPeriodWorkGoal::class
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
class AccompanyingPeriodWorkGoal
|
||||
{
|
||||
@@ -18,11 +25,14 @@ class AccompanyingPeriodWorkGoal
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private $note;
|
||||
|
||||
@@ -33,12 +43,16 @@ class AccompanyingPeriodWorkGoal
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Goal::class)
|
||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private $goal;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals")
|
||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result")
|
||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private $results;
|
||||
|
||||
@@ -71,6 +85,13 @@ class AccompanyingPeriodWorkGoal
|
||||
|
||||
public function setAccompanyingPeriodWork(?AccompanyingPeriodWork $accompanyingPeriodWork): self
|
||||
{
|
||||
if ($this->accompanyingPeriodWork instanceof AccompanyingPeriodWork
|
||||
&& $accompanyingPeriodWork !== $this->accompanyingPeriodWork
|
||||
&& $accompanyingPeriodWork !== null
|
||||
) {
|
||||
throw new \LogicException("Change accompanying period work is not allowed");
|
||||
}
|
||||
|
||||
$this->accompanyingPeriodWork = $accompanyingPeriodWork;
|
||||
|
||||
return $this;
|
||||
|
Reference in New Issue
Block a user