Form & save into DB

This commit is contained in:
Jean-Francois Monfort
2021-05-06 09:36:03 +02:00
parent 82d8556f24
commit 4d8afd53ad
7 changed files with 109 additions and 134 deletions

View File

@@ -69,9 +69,9 @@ class Activity implements HasCenterInterface, HasScopeInterface
private \DateTime $date;
/**
* @ORM\Column(type="time")
* @ORM\Column(type="time", nullable=true)
*/
private \DateTime $durationTime;
private ?\DateTime $durationTime = null;
/**
* @ORM\Column(type="time", nullable=true)
@@ -81,7 +81,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
*/
private ActivityPresence $attendee;
private ?ActivityPresence $attendee = null;
/**
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
@@ -148,17 +148,11 @@ class Activity implements HasCenterInterface, HasScopeInterface
$this->users = new ArrayCollection();
}
/**
* Get id
*/
public function getId(): int
{
return $this->id;
}
/**
* Set user
*/
public function setUser(User $user): self
{
$this->user = $user;
@@ -166,17 +160,11 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
/**
* Get user
*/
public function getUser(): User
{
return $this->user;
}
/**
* Set date
*/
public function setDate(\DateTime $date): self
{
$this->date = $date;
@@ -184,28 +172,19 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
/**
* Get date
*/
public function getDate(): \DateTime
{
return $this->date;
}
/**
* Set durationTime
*/
public function setDurationTime(\DateTime $durationTime): self
public function setDurationTime(?\DateTime $durationTime): self
{
$this->durationTime = $durationTime;
return $this;
}
/**
* Get durationTime
*/
public function getDurationTime(): \DateTime
public function getDurationTime(): ?\DateTime
{
return $this->durationTime;
}
@@ -229,17 +208,14 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
public function getAttendee(): ActivityPresence
public function getAttendee(): ?ActivityPresence
{
return $this->attendee;
}
/**
* Add a reason
*/
public function addReason(ActivityReason $reason): self
{
$this->reasons[] = $reason;
$this->reasons->add($reason);
return $this;
}
@@ -249,17 +225,18 @@ class Activity implements HasCenterInterface, HasScopeInterface
$this->reasons->removeElement($reason);
}
/**
* Get reasons
*/
public function getReasons(): Collection
{
return $this->reasons;
}
/**
* Set type
*/
public function setReasons(?ArrayCollection $reasons): self
{
$this->reasons = $reasons;
return $this;
}
public function setType(ActivityType $type): self
{
$this->type = $type;
@@ -267,17 +244,11 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
/**
* Get type
*/
public function getType(): ActivityType
{
return $this->type;
}
/**
* Set scope
*/
public function setScope(Scope $scope): self
{
$this->scope = $scope;
@@ -285,17 +256,11 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
/**
* Get scope
*/
public function getScope(): ?Scope
{
return $this->scope;
}
/**
* Set person
*/
public function setPerson(Person $person): self
{
$this->person = $person;
@@ -303,9 +268,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
/**
* Get person
*/
public function getPerson(): Person
{
return $this->person;
@@ -453,9 +415,9 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this->sentReceived;
}
public function setSentReceived(string $sentReceived): self
public function setSentReceived(?string $sentReceived): self
{
$this->sentReceived = $sentReceived;
$this->sentReceived = (string) $sentReceived;
return $this;
}