src/Entity/Pos.php line 12
<?phpnamespace App\Entity;use App\Repository\PosRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: PosRepository::class)]class Pos{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(type: Types::DATETIME_MUTABLE)]private ?\DateTimeInterface $dateStart = null;#[ORM\Column(type: Types::DATETIME_MUTABLE,nullable: true)]private ?\DateTimeInterface $dateEnd = null;#[ORM\ManyToOne(inversedBy: 'poss')]#[ORM\JoinColumn(nullable: false)]private ?User $user = null;#[ORM\Column(nullable: true)]private ?float $initialAmount= null;#[ORM\OneToMany(mappedBy: 'pos', targetEntity: Order::class, orphanRemoval: true)]private Collection $orders;#[ORM\Column(nullable: true)]private ?float $finalAmount = null;public function __construct(){$this->orders = new ArrayCollection();$this->initialAmount = 0;$this->finalAmount = 0;}public function getId(): ?int{return $this->id;}public function getDateStart(): ?\DateTimeInterface{return $this->dateStart;}public function setDateStart(\DateTimeInterface $dateStart): self{$this->dateStart = $dateStart;return $this;}public function getDateEnd(): ?\DateTimeInterface{return $this->dateEnd;}public function setDateEnd(\DateTimeInterface $dateEnd): self{$this->dateEnd = $dateEnd;return $this;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): self{$this->user = $user;return $this;}public function getInitialAmount(): ?float{return $this->initialAmount;}public function setInitialAmount(float $initialAmount): self{$this->initialAmount = $initialAmount;return $this;}/*** @return Collection<int, Order>*/public function getOrders(): Collection{return $this->orders;}public function addOrder(Order $order): self{if (!$this->orders->contains($order)) {$this->orders->add($order);$order->setPos($this);}return $this;}public function removeOrder(Order $order): self{if ($this->orders->removeElement($order)) {// set the owning side to null (unless already changed)if ($order->getPos() === $this) {$order->setPos(null);}}return $this;}public function getFinalAmount(): ?float{return $this->finalAmount;}public function setFinalAmount(?float $finalAmount): self{$this->finalAmount = $finalAmount;return $this;}public function __toString(): string{return $this->getUser()->getUsername();}}