WIP: WIP
This commit is contained in:
1 parent
8740041e7a
commit
8e3499581a
35 files changed
+119
-1109
No files matched your search
@@ -6,13 +6,13 @@ 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;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
#[ORM\Entity(repositoryClass: AssignmentRepository::class)]
|
||||
class Assignment implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
@@ -30,7 +30,7 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[Assert\NotNull(message: 'Bitte gib die Destination an')]
|
||||
private ?BpnDate $destination = null;
|
||||
private ?Destination $destination = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[Assert\NotNull(message: 'Bitte gib das Jobprofil an')]
|
||||
@@ -91,12 +91,12 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
public function getDestination(): ?BpnDate
|
||||
public function getDestination(): ?Destination
|
||||
{
|
||||
return $this->destination;
|
||||
}
|
||||
|
||||
public function setDestination(?BpnDate $destination): static
|
||||
public function setDestination(?Destination $destination): static
|
||||
{
|
||||
$this->destination = $destination;
|
||||
|
||||
@@ -151,6 +151,15 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTotalPeriod(): CarbonPeriod
|
||||
{
|
||||
$destination = $this->getDestination();
|
||||
$dateFrom = $this->getDateFrom() ?? $destination->getDateFrom();
|
||||
$dateTo = $this->getDateTo() ?? $destination->getDateTo();
|
||||
|
||||
return new CarbonPeriod($dateFrom, $dateTo);
|
||||
}
|
||||
|
||||
public function getPickupDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->pickupDate;
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\BpnDateRepository;
|
||||
use App\Repository\DestinationRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: BpnDateRepository::class)]
|
||||
class BpnDate
|
||||
#[ORM\Entity(repositoryClass: DestinationRepository::class)]
|
||||
class Destination
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
@@ -26,9 +26,6 @@ class BpnDate
|
||||
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
||||
private ?\DateTimeImmutable $dateTo = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $bus;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $product = null;
|
||||
|
||||
@@ -44,11 +41,6 @@ class BpnDate
|
||||
#[ORM\Column]
|
||||
private array $pickups = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bus = false;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return sprintf('%s - %s: %s, %s',
|
||||
@@ -100,18 +92,6 @@ class BpnDate
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isBus(): ?bool
|
||||
{
|
||||
return $this->bus;
|
||||
}
|
||||
|
||||
public function setBus(bool $bus): static
|
||||
{
|
||||
$this->bus = $bus;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCode(): ?string
|
||||
{
|
||||
return $this->code;
|
||||
@@ -183,4 +163,9 @@ class BpnDate
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function hasBusTransfer(): bool
|
||||
{
|
||||
return 0 < count($this->getPickups());
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\DispositionRequirementRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: DispositionRequirementRepository::class)]
|
||||
class DispositionRequirement
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
private ?Training $training = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
|
||||
private ?\DateTimeImmutable $pickupDate = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'requirements')]
|
||||
private ?Assignment $assignment = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getTraining(): ?Training
|
||||
{
|
||||
return $this->training;
|
||||
}
|
||||
|
||||
public function setTraining(?Training $training): static
|
||||
{
|
||||
$this->training = $training;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPickupDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->pickupDate;
|
||||
}
|
||||
|
||||
public function setPickupDate(?\DateTimeImmutable $pickupDate): static
|
||||
{
|
||||
$this->pickupDate = $pickupDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAssignment(): ?Assignment
|
||||
{
|
||||
return $this->assignment;
|
||||
}
|
||||
|
||||
public function setAssignment(?Assignment $assignment): static
|
||||
{
|
||||
$this->assignment = $assignment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user