mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 22:04:23 +00:00
83 lines
1.9 KiB
PHP
83 lines
1.9 KiB
PHP
<?php
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Chill\PersonBundle\Entity\Person;
|
|
|
|
use Chill\MainBundle\Entity\Address;
|
|
use Chill\PersonBundle\Entity\Person;
|
|
use DateTimeImmutable;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
/**
|
|
* Entity which associate person with his current address, through
|
|
* household participation.
|
|
*
|
|
* The computation is optimized on database side.
|
|
*
|
|
* The validFrom and validTo properties are the intersection of
|
|
* household membership and address validity. See @see{PersonHouseholdAddress}
|
|
*
|
|
* @ORM\Entity(readOnly=true)
|
|
* @ORM\Table("view_chill_person_current_address")
|
|
*/
|
|
class PersonCurrentAddress
|
|
{
|
|
/**
|
|
* @ORM\OneToOne(targetEntity=Address::class)
|
|
*/
|
|
protected Address $address;
|
|
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\OneToOne(targetEntity=Person::class, inversedBy="currentPersonAddress")
|
|
* @ORM\JoinColumn(name="person_id", referencedColumnName="id")
|
|
*/
|
|
protected Person $person;
|
|
|
|
/**
|
|
* @ORM\Column(name="valid_from", type="date_immutable")
|
|
*/
|
|
protected DateTimeImmutable $validFrom;
|
|
|
|
/**
|
|
* @ORM\Column(name="valid_to", type="date_immutable")
|
|
*/
|
|
protected ?DateTimeImmutable $validTo;
|
|
|
|
public function getAddress(): Address
|
|
{
|
|
return $this->address;
|
|
}
|
|
|
|
public function getPerson(): Person
|
|
{
|
|
return $this->person;
|
|
}
|
|
|
|
/**
|
|
* This date is the intersection of household membership
|
|
* and address validity.
|
|
*/
|
|
public function getValidFrom(): DateTimeImmutable
|
|
{
|
|
return $this->validFrom;
|
|
}
|
|
|
|
/**
|
|
* This date is the intersection of household membership
|
|
* and address validity.
|
|
*/
|
|
public function getValidTo(): ?DateTimeImmutable
|
|
{
|
|
return $this->validTo;
|
|
}
|
|
}
|