Use annoations for serialization

This commit is contained in:
2021-05-11 19:49:41 +02:00
parent 3f64db3b3a
commit a4989f99d6
5 changed files with 48 additions and 67 deletions

View File

@@ -33,6 +33,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Chill\MainBundle\Entity\User;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* AccompanyingPeriod Class
@@ -80,6 +81,7 @@ class AccompanyingPeriod
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
* @Groups({"read"})
*/
private $id;
@@ -87,6 +89,7 @@ class AccompanyingPeriod
* @var \DateTime
*
* @ORM\Column(type="date")
* @Groups({"read", "write"})
*/
private $openingDate;
@@ -94,6 +97,7 @@ class AccompanyingPeriod
* @var \DateTime
*
* @ORM\Column(type="date", nullable=true)
* @Groups({"read", "write"})
*/
private $closingDate = null;
@@ -101,6 +105,7 @@ class AccompanyingPeriod
* @var string
*
* @ORM\Column(type="text")
* @Groups({"read", "write"})
*/
private $remark = '';
@@ -110,6 +115,7 @@ class AccompanyingPeriod
* @ORM\OneToMany(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\Comment",
* mappedBy="accompanyingPeriod"
* )
* @Groups({"read"})
*/
private $comments;
@@ -119,6 +125,7 @@ class AccompanyingPeriod
* @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class,
* mappedBy="accompanyingPeriod",
* cascade={"persist", "refresh", "remove", "merge", "detach"})
* @Groups({"read"})
*/
private $participations;
@@ -128,18 +135,21 @@ class AccompanyingPeriod
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive")
* @ORM\JoinColumn(nullable=true)
* @Groups({"read", "write"})
*/
private $closingMotive = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=true)
* @Groups({"read", "write"})
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=true)
* @Groups({"read"})
*/
private $createdBy;
@@ -152,12 +162,14 @@ class AccompanyingPeriod
/**
* @ORM\ManyToOne(targetEntity=Origin::class)
* @ORM\JoinColumn(nullable=true)
* @Groups({"read", "write"})
*/
private $origin;
/**
* @var string
* @ORM\Column(type="string", nullable=true)
* @Groups({"read", "write"})
*/
private $intensity;
@@ -172,6 +184,7 @@ class AccompanyingPeriod
* joinColumns={@ORM\JoinColumn(name="accompanying_period_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="scope_id", referencedColumnName="id")}
* )
* @Groups({"read"})
*/
private $scopes;
@@ -190,18 +203,21 @@ class AccompanyingPeriod
/**
* @var bool
* @ORM\Column(type="boolean")
* @Groups({"read", "write"})
*/
private $requestorAnonymous = false;
/**
* @var bool
* @ORM\Column(type="boolean")
* @Groups({"read", "write"})
*/
private $emergency = false;
/**
* @var bool
* @ORM\Column(type="boolean")
* @Groups({"read", "write"})
*/
private $confidential = false;
@@ -212,6 +228,7 @@ class AccompanyingPeriod
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\Resource",
* mappedBy="accompanyingPeriod"
* )
* @Groups({"read"})
*/
private $resources;
@@ -536,6 +553,7 @@ class AccompanyingPeriod
/**
* @return Person|ThirdParty
* @Groups({"read"})
*/
public function getRequestor()
{