Add missing fields & migrations

This commit is contained in:
Jean-Francois Monfort
2021-04-22 14:47:00 +02:00
parent c233c481b6
commit 05ebdefd47
6 changed files with 253 additions and 21 deletions

View File

@@ -48,6 +48,9 @@ use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
*/
class Activity implements HasCenterInterface, HasScopeInterface
{
const SENTRECEIVED_SENT = 'sent';
const SENTRECEIVED_RECEIVED = 'received';
/**
* @ORM\Id
* @ORM\Column(name="id", type="integer")
@@ -71,9 +74,14 @@ class Activity implements HasCenterInterface, HasScopeInterface
private \DateTime $durationTime;
/**
* @ORM\Column(type="boolean")
* @ORM\Column(type="time")
*/
private bool $attendee;
private \DateTime $travelTime;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
*/
private ActivityPresence $attendee;
/**
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
@@ -101,25 +109,35 @@ class Activity implements HasCenterInterface, HasScopeInterface
private CommentEmbeddable $comment;
/**
* @ORM\OneToMany(targetEntity="Chill\PersonBundle\Entity\Person", mappedBy="person")
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private ArrayCollection $persons;
/**
* @ORM\OneToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", mappedBy="thirdParty")
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
*/
private ArrayCollection $thirdParties;
/**
* @ORM\OneToMany(targetEntity="Chill\DocStoreBundle\Entity\Document", mappedBy="document")
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\Document")
*/
private ArrayCollection $documents;
/**
* @ORM\Column(type="boolean")
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
*/
private ArrayCollection $users;
/**
* @ORM\Column(type="boolean", options={"default"=false})
*/
private bool $emergency = false;
/**
* @ORM\Column(type="string", options={"default"=""})
*/
private string $sentReceived = '';
public function __construct()
{
$this->reasons = new ArrayCollection();
@@ -127,6 +145,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
$this->persons = new ArrayCollection();
$this->thirdParties = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->users = new ArrayCollection();
}
/**
@@ -191,20 +210,26 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this->durationTime;
}
/**
* Set attendee
*/
public function setAttendee(bool $attendee): self
public function setTravelTime(\DateTime $travelTime): self
{
$this->travelTime = $travelTime;
return $this;
}
public function getTravelTime(): \DateTime
{
return $this->travelTime;
}
public function setAttendee(ActivityPresence $attendee): self
{
$this->attendee = $attendee;
return $this;
}
/**
* Get attendee
*/
public function getAttendee(): bool
public function getAttendee(): ActivityPresence
{
return $this->attendee;
}
@@ -382,6 +407,30 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
public function addUser(User $user): self
{
$this->users[] = $user;
return $this;
}
public function removeUser(User $user): void
{
$this->users->removeElement($user);
}
public function getUsers(): ArrayCollection
{
return $this->users;
}
public function setUsers(ArrayCollection $users): self
{
$this->users = $users;
return $this;
}
public function isEmergency(): bool
{
return $this->getEmergency();
@@ -398,5 +447,17 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
public function getSentReceived(): string
{
return $this->sentReceived;
}
public function setSentReceived(string $sentReceived): self
{
$this->sentReceived = $sentReceived;
return $this;
}
}