mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
first impl of event (WIP)
This commit is contained in:
@@ -21,6 +21,7 @@ use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Entity\UserJob;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodLocationHistory;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
||||
@@ -113,6 +114,12 @@ class AccompanyingPeriod implements
|
||||
*/
|
||||
public const STEP_DRAFT = 'DRAFT';
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity=AccompanyingPeriodLocationHistory::class,
|
||||
* mappedBy="period")
|
||||
*/
|
||||
private Collection $locationHistories;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity=Address::class
|
||||
@@ -384,6 +391,7 @@ class AccompanyingPeriod implements
|
||||
$this->works = new ArrayCollection();
|
||||
$this->resources = new ArrayCollection();
|
||||
$this->userHistories = new ArrayCollection();
|
||||
$this->locationHistories = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1036,7 +1044,9 @@ class AccompanyingPeriod implements
|
||||
*/
|
||||
public function setAddressLocation(?Address $addressLocation = null): self
|
||||
{
|
||||
$this->addressLocation = $addressLocation;
|
||||
if ($this->addressLocation !== $addressLocation) {
|
||||
$this->addressLocation = $addressLocation;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -1259,4 +1269,28 @@ class AccompanyingPeriod implements
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLocationHistories(): Collection
|
||||
{
|
||||
return $this->locationHistories;
|
||||
}
|
||||
|
||||
public function addLocationHistory(AccompanyingPeriodLocationHistory $history): self
|
||||
{
|
||||
if (!$this->locationHistories->contains($history)) {
|
||||
$this->locationHistories[] = $history;
|
||||
$history->setPeriod($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeLocationHistory(AccompanyingPeriodLocationHistory $history): self
|
||||
{
|
||||
if ($this->locationHistories->removeElement($history)) {
|
||||
$history->setPeriod(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table("chill_person_accompanying_period_location_history")
|
||||
*/
|
||||
class AccompanyingPeriodLocationHistory
|
||||
{
|
||||
use TrackCreationTrait;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
|
||||
*/
|
||||
private AccompanyingPeriod $period;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class)
|
||||
*/
|
||||
private ?Person $personLocation;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Address::class)
|
||||
*/
|
||||
private ?Address $addressLocation;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable")
|
||||
*/
|
||||
private ?\DateTimeImmutable $startDate;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable")
|
||||
*/
|
||||
private ?\DateTimeImmutable $endDate;
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Person|null
|
||||
*/
|
||||
public function getPersonLocation(): ?Person
|
||||
{
|
||||
return $this->personLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Person|null $personLocation
|
||||
* @return AccompanyingPeriodLocationHistory
|
||||
*/
|
||||
public function setPersonLocation(?Person $personLocation): AccompanyingPeriodLocationHistory
|
||||
{
|
||||
$this->personLocation = $personLocation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Address|null
|
||||
*/
|
||||
public function getAddressLocation(): ?Address
|
||||
{
|
||||
return $this->addressLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Address|null $addressLocation
|
||||
* @return AccompanyingPeriodLocationHistory
|
||||
*/
|
||||
public function setAddressLocation(?Address $addressLocation): AccompanyingPeriodLocationHistory
|
||||
{
|
||||
$this->addressLocation = $addressLocation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTimeImmutable|null
|
||||
*/
|
||||
public function getStartDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTimeImmutable|null $startDate
|
||||
* @return AccompanyingPeriodLocationHistory
|
||||
*/
|
||||
public function setStartDate(?\DateTimeImmutable $startDate): AccompanyingPeriodLocationHistory
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTimeImmutable|null
|
||||
*/
|
||||
public function getEndDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTimeImmutable|null $endDate
|
||||
* @return AccompanyingPeriodLocationHistory
|
||||
*/
|
||||
public function setEndDate(?\DateTimeImmutable $endDate): AccompanyingPeriodLocationHistory
|
||||
{
|
||||
$this->endDate = $endDate;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AccompanyingPeriod
|
||||
*/
|
||||
public function getPeriod(): AccompanyingPeriod
|
||||
{
|
||||
return $this->period;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal use AccompanyingPeriod::addLocationHistory
|
||||
*/
|
||||
public function setPeriod(AccompanyingPeriod $period): AccompanyingPeriodLocationHistory
|
||||
{
|
||||
$this->period = $period;
|
||||
return $this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user