<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'invoice')]
#[ORM\Entity(repositoryClass: 'App\Entity\Repository\InvoiceRepository')]
class Invoice
{
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
#[ORM\Column(type: 'json', nullable: true)]
private $positions;
#[ORM\Column(type: 'json', nullable: true)]
private $address;
#[ORM\Column(type: 'string', nullable: true)]
private $type;
#[ORM\Column(type: 'string', nullable: true)]
private $invoicenumber;
#[ORM\Column(type: 'string', nullable: true)]
private $filename;
#[ORM\Column(type: 'json', nullable: true)]
private $paypal_transaction;
#[ORM\Column(type: 'decimal', nullable: true, scale: 2, precision: 6)]
private $value;
#[ORM\Column(type: 'decimal', nullable: true, precision: 6, scale: 2)]
private $net_value;
#[ORM\Column(type: 'decimal', nullable: true, precision: 6, scale: 2)]
private $vat_value;
#[ORM\Column(type: 'decimal', nullable: true, precision: 6, scale: 2)]
private $vat_rate;
#[ORM\Column(type: 'datetime', nullable: true)]
private $date_invoice;
#[ORM\Column(type: 'datetime', nullable: false)]
private $date_created;
#[ORM\OneToMany(targetEntity: 'App\Entity\Payment', mappedBy: 'invoice')]
private $payments;
#[ORM\ManyToOne(targetEntity: 'App\Entity\User', inversedBy: 'invoice')]
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false)]
private $user;
public function __construct()
{
$this->payments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getPositions()
{
return $this->positions;
}
public function setPositions($positions): self
{
$this->positions = $positions;
return $this;
}
public function getAddress()
{
return $this->address;
}
public function setAddress($address): self
{
$this->address = $address;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getInvoicenumber(): ?string
{
return $this->invoicenumber;
}
public function setInvoicenumber(?string $invoicenumber): self
{
$this->invoicenumber = $invoicenumber;
return $this;
}
public function getPaypalTransaction()
{
return $this->paypal_transaction;
}
public function setPaypalTransaction($paypal_transaction): self
{
$this->paypal_transaction = $paypal_transaction;
return $this;
}
public function getDateInvoice(): ?\DateTimeInterface
{
return $this->date_invoice;
}
public function setDateInvoice(?\DateTimeInterface $date_invoice): self
{
$this->date_invoice = $date_invoice;
return $this;
}
public function getDateCreated(): ?\DateTimeInterface
{
return $this->date_created;
}
public function setDateCreated(?\DateTimeInterface $date_created): self
{
$this->date_created = $date_created;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function addPayment(Payment $payment): self
{
if (!$this->payments->contains($payment)) {
$this->payments[] = $payment;
$payment->setInvoice($this);
}
return $this;
}
public function removePayment(Payment $payment): self
{
if ($this->payments->contains($payment)) {
$this->payments->removeElement($payment);
// set the owning side to null (unless already changed)
if ($payment->getInvoice() === $this) {
$payment->setInvoice(null);
}
}
return $this;
}
public function getValue()
{
return $this->value;
}
public function setValue($value): self
{
$this->value = $value;
return $this;
}
public function getVatValue()
{
return $this->vat_value;
}
public function setVatValue($vat_value): self
{
$this->vat_value = $vat_value;
return $this;
}
public function getVatRate()
{
return $this->vat_rate;
}
public function setVatRate($vat_rate): self
{
$this->vat_rate = $vat_rate;
return $this;
}
/**
* @return Collection|Payment[]
*/
public function getPayment(): Collection
{
return $this->payment;
}
public function getFilename(): ?string
{
return $this->filename;
}
public function setFilename(?string $filename): self
{
$this->filename = $filename;
return $this;
}
public function getNetValue()
{
return $this->net_value;
}
public function setNetValue($net_value): self
{
$this->net_value = $net_value;
return $this;
}
}