mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-01 10:59:45 +00:00
ChillPersonBundle: add administrativeStatus property to Person
This commit is contained in:
80
src/Bundle/ChillPersonBundle/Entity/AdministrativeStatus.php
Normal file
80
src/Bundle/ChillPersonBundle/Entity/AdministrativeStatus.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?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;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_person_administrative_status' => AdministrativeStatus::class])]
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'chill_person_administrative_status')]
|
||||
class AdministrativeStatus
|
||||
{
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
private ?int $id = null;
|
||||
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
|
||||
#[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])]
|
||||
private array $name = [];
|
||||
|
||||
#[Serializer\Groups(['read'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
private bool $active = true;
|
||||
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'ordering', nullable: true, options: ['default' => '0.0'])]
|
||||
private float $order = 0;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getActive(): ?bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function getName(): ?array
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getOrder(): ?float
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
public function setActive(bool $active): self
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setName(array $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setOrder(float $order): self
|
||||
{
|
||||
$this->order = $order;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -304,6 +304,13 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
private string $memo = '';
|
||||
|
||||
/**
|
||||
* The person's administrative status.
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: AdministrativeStatus::class)]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?AdministrativeStatus $administrativeStatus = null;
|
||||
|
||||
/**
|
||||
* The person's mobile phone number.
|
||||
*/
|
||||
@@ -777,6 +784,11 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
return $this->addresses;
|
||||
}
|
||||
|
||||
public function getAdministrativeStatus(): ?AdministrativeStatus
|
||||
{
|
||||
return $this->administrativeStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the age of a person, calculated at the date 'now'.
|
||||
*
|
||||
@@ -1420,6 +1432,13 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAdministrativeStatus(?AdministrativeStatus $administrativeStatus): self
|
||||
{
|
||||
$this->administrativeStatus = $administrativeStatus;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAcceptSMS(bool $acceptSMS): self
|
||||
{
|
||||
$this->acceptSMS = $acceptSMS;
|
||||
|
Reference in New Issue
Block a user