WIP: Implement application process
This commit is contained in:
@@ -6,37 +6,57 @@ use App\Entity\Traits\TimestampableEntity;
|
||||
use App\Repository\ApplicationRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ApplicationRepository::class)]
|
||||
class Application implements TimestampableEntityInterface
|
||||
{
|
||||
use TimestampableEntity;
|
||||
|
||||
public const STATUS_NEW = 'new';
|
||||
public const STATUS_PENDING = 'pending';
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'applications')]
|
||||
private ?Assignment $assignment = null;
|
||||
#[ORM\Column(type: 'string', length: 36, unique: true)]
|
||||
private string $uuid;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'applications')]
|
||||
private ?Teamer $teamer = null;
|
||||
private ?Assignment $assignment;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'applications')]
|
||||
private ?Teamer $teamer;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $requests = null;
|
||||
|
||||
#[ORM\Column(length: 64)]
|
||||
private ?string $status = null;
|
||||
private ?string $status;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $remarks = null;
|
||||
|
||||
public function __construct(Assignment $assignment, Teamer $teamer)
|
||||
{
|
||||
$this->uuid = Uuid::v4();
|
||||
$this->assignment = $assignment;
|
||||
$this->teamer = $teamer;
|
||||
$this->status = static::STATUS_NEW;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUuid(): string
|
||||
{
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
public function getAssignment(): ?Assignment
|
||||
{
|
||||
return $this->assignment;
|
||||
|
||||
+25
-11
@@ -4,7 +4,6 @@ namespace App\Entity;
|
||||
|
||||
use App\Entity\Traits\BlameableEntity;
|
||||
use App\Entity\Traits\TimestampableEntity;
|
||||
use App\Model\BenefitsDto;
|
||||
use App\Repository\AssignmentRepository;
|
||||
use Carbon\CarbonPeriod;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
@@ -38,7 +37,10 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
#[Assert\Range(min: 1, minMessage: 'Die Mindestanzahl ist 1')]
|
||||
private ?int $available = 1;
|
||||
private ?int $availableDispositions = 1;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $showAvailableDispositions = false;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
|
||||
private ?\DateTimeImmutable $dateFrom = null;
|
||||
@@ -53,8 +55,8 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $pickup = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private array $benefits;
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $benefits;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $remarks = null;
|
||||
@@ -78,7 +80,7 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
$this->fees = new ArrayCollection();
|
||||
$this->applications = new ArrayCollection();
|
||||
$this->dispositions = new ArrayCollection();
|
||||
$this->benefits = BenefitsDto::$defaults;
|
||||
$this->benefits = "Anreise im E&P Reisebus\nUnterkunft\nVerpflegung\nSkipass\n";
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -115,14 +117,26 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAvailable(): ?int
|
||||
public function getAvailableDispositions(): ?int
|
||||
{
|
||||
return $this->available;
|
||||
return $this->availableDispositions;
|
||||
}
|
||||
|
||||
public function setAvailable(?int $available): static
|
||||
public function setAvailableDispositions(?int $availableDispositions): static
|
||||
{
|
||||
$this->available = $available;
|
||||
$this->availableDispositions = $availableDispositions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isShowAvailableDispositions(): ?bool
|
||||
{
|
||||
return $this->showAvailableDispositions;
|
||||
}
|
||||
|
||||
public function setShowAvailableDispositions(bool $showAvailableDispositions): static
|
||||
{
|
||||
$this->showAvailableDispositions = $showAvailableDispositions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -184,12 +198,12 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBenefits(): array
|
||||
public function getBenefits(): ?string
|
||||
{
|
||||
return $this->benefits;
|
||||
}
|
||||
|
||||
public function setBenefits(array $benefits): static
|
||||
public function setBenefits(?string $benefits): static
|
||||
{
|
||||
$this->benefits = $benefits;
|
||||
|
||||
|
||||
@@ -692,6 +692,11 @@ class Teamer implements TimestampableEntityInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function hasPickup(int $pickupId): bool
|
||||
{
|
||||
return in_array($pickupId, $this->getPickups());
|
||||
}
|
||||
|
||||
public function getLanguage(): ?string
|
||||
{
|
||||
return $this->language;
|
||||
|
||||
Reference in New Issue
Block a user