WIP Impelement more stuff
This commit is contained in:
+22
-8
@@ -121,11 +121,11 @@ class Teamer implements TimestampableEntityInterface
|
||||
#[ORM\Column]
|
||||
private array $pickups = [];
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
#[Assert\NotBlank(message: 'Bitte gib deine Sprache(n) an', groups: ['profile', 'profile_preflight'])]
|
||||
private ?string $language = null;
|
||||
|
||||
#[ORM\Column(length: 2)]
|
||||
#[ORM\Column(length: 2, nullable: true)]
|
||||
private ?string $size = null;
|
||||
|
||||
public function __construct()
|
||||
@@ -143,6 +143,11 @@ class Teamer implements TimestampableEntityInterface
|
||||
$this->customAvailabilities = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getFullName();
|
||||
}
|
||||
|
||||
public function toPayload(): array
|
||||
{
|
||||
// Transform gender value
|
||||
@@ -224,6 +229,15 @@ class Teamer implements TimestampableEntityInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFullName(bool $formal = false): string
|
||||
{
|
||||
if (true === $formal) {
|
||||
return sprintf('%s, %s', $this->getLastName(), $this->getFirstName());
|
||||
}
|
||||
|
||||
return sprintf('%s %s', $this->getFirstName(), $this->getLastName());
|
||||
}
|
||||
|
||||
public function getGender(): ?string
|
||||
{
|
||||
return $this->gender;
|
||||
@@ -494,15 +508,15 @@ class Teamer implements TimestampableEntityInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function hasTraining(Training $training): bool
|
||||
public function getTrainingAttendance(Training $training): ?TrainingAttendance
|
||||
{
|
||||
foreach ($this->getTrainingAttendances() as $attendance) {
|
||||
if ($attendance->getTraining() === $training) {
|
||||
return true;
|
||||
return $attendance;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -535,15 +549,15 @@ class Teamer implements TimestampableEntityInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function hasLicenseOfType(string $type): bool
|
||||
public function getLicenseOfType(string $type): ?License
|
||||
{
|
||||
foreach ($this->getLicenses() as $license) {
|
||||
if ($type === $license->getType()) {
|
||||
return true;
|
||||
return $license;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user