feat: collect teamers' meal preferences
This commit is contained in:
1 parent
e7f3233dbc
commit
15a4af93f9
15 files changed
+427
No files matched your search
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use App\Entity\Teamer;
|
||||
use App\Enum\MealPreference;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class MealPreferenceDto
|
||||
{
|
||||
#[Assert\NotNull(message: 'Bitte gib deine Ernährungsweise an')]
|
||||
private ?MealPreference $mealPreference = null;
|
||||
|
||||
public static function fromTeamer(Teamer $teamer): self
|
||||
{
|
||||
return (new self())->setMealPreference($teamer->getMealPreference());
|
||||
}
|
||||
|
||||
public function applyTo(Teamer $teamer): void
|
||||
{
|
||||
$teamer->setMealPreference($this->getMealPreference());
|
||||
}
|
||||
|
||||
public function getMealPreference(): ?MealPreference
|
||||
{
|
||||
return $this->mealPreference;
|
||||
}
|
||||
|
||||
public function setMealPreference(?MealPreference $mealPreference): static
|
||||
{
|
||||
$this->mealPreference = $mealPreference;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user