src/Entity/SupplierInvoices.php line 29
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Index;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\OneToOne;
use Doctrine\ORM\Mapping\OneToMany;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
use Doctrine\ORM\Mapping\PrePersist;
use Doctrine\ORM\Mapping\PreUpdate;
use Symfony\Component\Validator\Constraints as Assert;
/**
* SupplierInvoices
*/
#[Entity]
#[HasLifecycleCallbacks]
#[Table(name: 'supplier_invoices')]
#[Index(name: 'created_by_fk_idx', columns: ['created_by'])]
#[Index(name: 'updated_by_fk_idx', columns: ['updated_by'])]
#[Index(name: 'supplier_invoices_issuer_fk', columns: ['issuer_id'])]
class SupplierInvoices
{
/**
* @var integer
*/
#[Column(name: 'invoice_id', type: 'integer', nullable: false)]
#[Id]
#[GeneratedValue(strategy: 'IDENTITY')]
private $invoiceId;
/**
* @var string
*/
#[Assert\Regex(pattern: '/^[a-zA-Z0-9]*$/')]
#[Column(name: 'invoice_number', type: 'string', length: 100, nullable: true)]
private $invoiceNumber;
/**
* @var float
*/
#[Assert\GreaterThan(0)]
#[Column(name: 'value', type: 'float', precision: 10, scale: 0, nullable: true)]
private $value;
/**
* @var float
*/
#[Column(name: 'vat_amount', type: 'float', precision: 10, scale: 0, nullable: true)]
private $vatAmount;
/**
* @var float
*/
#[Assert\Regex(pattern: '/^[+]?([.]\d+|\d+([.]\d+)?)$/', message: 'not Valid')]
#[Assert\GreaterThan(0)]
#[Column(name: 'total', type: 'float', precision: 10, scale: 0, nullable: true)]
private $total;
/**
* @var boolean
*/
#[Column(name: 'is_payed', type: 'boolean', nullable: true)]
private $isPayed;
/**
* @var \DateTime
*/
#[Column(name: 'payment_date', type: 'date', nullable: true)]
private $paymentDate;
/**
* @var string
*/
#[Column(name: 'payment_type', type: 'string', nullable: true, columnDefinition: "enum('Cash','Check','Transfer','Mada')")]
private $paymentType;
/**
* available payment types
*/
const PAYMENT_TYPES = [
'Cash' => 'Cash',
'Check' => 'Check',
'Transfer' => 'Transfer',
'Mada' => 'Mada'
];
/**
* @var string
*/
#[Column(name: 'image_path', type: 'string', length: 100, nullable: true)]
private $imagePath;
/**
* @var \Companies
*/
#[ManyToOne(targetEntity: \Companies::class)]
#[JoinColumn(name: 'issuer_id', referencedColumnName: 'company_id')]
private $issuer;
/**
* @var \RtsInvoice
*
*
*/
#[OneToOne(targetEntity: \VehicleRtsActivitiesInvoices::class, cascade: ['persist'], mappedBy: 'supplierInvoice')]
private $rtsInvoice;
/**
* @var \vehicleBeneficiary
*/
#[OneToOne(targetEntity: \VehicleBeneficiaryDetails::class, cascade: ['all'], mappedBy: 'purchaseInvoice')]
private $vehicleBeneficiary;
/**
* @var \otInvoice
*/
#[OneToOne(targetEntity: \VehicleOwnershipTransferInvoices::class, cascade: ['all'], mappedBy: 'supplierInvoice')]
private $otInvoice;
/**
* @var \otInvoice
*/
#[OneToOne(targetEntity: \VehicleRepairInvoices::class, cascade: ['all'], mappedBy: 'supplierInvoice')]
private $vehicleRepairInvoice;
/**
* @var string
*
*/
private $imageWebPath;
/**
* @var invoice
*/
#[OneToOne(targetEntity: \Invoices::class, mappedBy: 'supplierInvoice', cascade: ['persist'])]
#[Assert\Valid]
private $invoice;
/**
* @var trafficViolation
*/
#[OneToOne(targetEntity: \VehicleTrafficViolations::class, mappedBy: 'supplierInvoice', cascade: ['persist'])]
private $trafficViolation;
/**
* @var \DateTime
*/
#[Column(name: 'created_at', type: 'datetime', nullable: true)]
private $createdAt;
/**
* @var \Users
*/
#[ManyToOne(targetEntity: \Users::class)]
#[JoinColumn(name: 'created_by', referencedColumnName: 'user_id')]
private $createdBy;
/**
* @var \DateTime
*/
#[Column(name: 'updated_at', type: 'datetime', nullable: true)]
private $updatedAt;
/**
* @var Users
*/
#[ManyToOne(targetEntity: \Users::class)]
#[JoinColumn(name: 'updated_by', referencedColumnName: 'user_id')]
private $updatedBy;
/**
* @var VatRate
*/
#[ManyToOne(targetEntity: \VatRate::class)]
#[JoinColumn(name: 'vat_rate_id', referencedColumnName: 'vat_rate_id')]
private $vatRate;
/**
* Get invoiceId
*
* @return integer
*/
public function getInvoiceId()
{
return $this->invoiceId;
}
/**
* Set invoiceNumber
*
* @param string $invoiceNumber
*
* @return SupplierInvoices
*/
public function setInvoiceNumber($invoiceNumber)
{
$this->invoiceNumber = $invoiceNumber;
return $this;
}
/**
* Get invoiceNumber
*
* @return string
*/
public function getInvoiceNumber()
{
return $this->invoiceNumber;
}
/**
* Set value
*
* @param float $value
*
* @return Invoices
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* Get value
*
* @return float
*/
public function getValue()
{
return $this->value;
}
/**
* Set vatAmount
*
* @param float $vatAmount
*
* @return Invoices
*/
public function setVatAmount($vatAmount)
{
$this->vatAmount = $vatAmount;
return $this;
}
/**
* Get vatAmount
*
* @return float
*/
public function getVatAmount()
{
return $this->vatAmount;
}
/**
* Set total
*
* @param float $total
*
* @return Invoices
*/
public function setTotal($total)
{
$this->total = $total;
return $this;
}
/**
* Get total
*
* @return float
*/
public function getTotal()
{
return $this->total;
}
/**
* Set isPayed
*
* @param boolean $isPayed
*
* @return SupplierInvoices
*/
public function setIsPayed($isPayed)
{
$this->isPayed = $isPayed;
return $this;
}
/**
* Get isPayed
*
* @return boolean
*/
public function getIsPayed()
{
return $this->isPayed;
}
/**
* Set paymentDate
*
* @param \DateTime $paymentDate
*
* @return SupplierInvoices
*/
public function setPaymentDate($paymentDate)
{
$this->paymentDate = $paymentDate;
return $this;
}
/**
* Get paymentDate
*
* @return \DateTime
*/
public function getPaymentDate()
{
return $this->paymentDate;
}
/**
* Set paymentType
*
* @param string $paymentType
*
* @return SupplierInvoices
*/
public function setPaymentType($paymentType)
{
$this->paymentType = $paymentType;
return $this;
}
/**
* Get paymentType
*
* @return string
*/
public function getPaymentType()
{
return $this->paymentType;
}
/**
* Set imagePath
*
* @param string $imagePath
*
* @return SupplierInvoices
*/
public function setImagePath($imagePath)
{
$this->imagePath = $imagePath;
return $this;
}
/**
* Get imagePath
*
* @return string
*/
public function getImagePath()
{
return $this->imagePath;
}
/**
* Set rtsInvoice
*
*
* @return SupplierInvoices
*/
public function setRtsInvoice(VehicleRtsActivitiesInvoices $rtsInvoice)
{
$this->rtsInvoice = $rtsInvoice;
//$this->rtsInvoice->setRtsInvoiceId($this->invoiceId);
return $this;
}
/**
* Get rtsInvoice
*
* @return \RtsInvoice
*/
public function getRtsInvoice()
{
return $this->rtsInvoice;
}
/**
* Set vehicleBeneficiary
*
*
* @return SupplierInvoices
*/
public function setVehicleBeneficiary(VehicleBeneficiaryDetails $purchaseInvoice= null)
{
$this->vehicleBeneficiary = $purchaseInvoice;
return $this;
}
/**
* Get vehicleBeneficiary
*
* @return VehicleBeneficiaryDetails
*/
public function getVehicleBeneficiary()
{
return $this->vehicleBeneficiary;
}
/**
* Set otInvoice
*
*
* @return SupplierInvoices
*/
public function setOtInvoice(VehicleOwnershipTransferInvoices $otInvoice= null)
{
$this->otInvoice = $otInvoice;
return $this;
}
/**
* Get otInvoice
*
* @return VehicleOwnershipTransferInvoices
*/
public function getOtInvoice()
{
return $this->otInvoice;
}
/**
* Set otInvoice
*
*
* @return SupplierInvoices
*/
public function setVehicleRepairInvoice(VehicleRepairInvoices $vehicleRepairInvoice= null)
{
$this->vehicleRepairInvoice = $vehicleRepairInvoice;
return $this;
}
/**
* Get otInvoice
*
* @return VehicleRepairInvoices
*/
public function getVehicleRepairInvoice()
{
return $this->vehicleRepairInvoice;
}
/**
* Set imagePath
*
* @param string $imageWebPath
*
* @return SupplierInvoices
*/
public function setImageWebPath($imageWebPath)
{
$this->imageWebPath = $imageWebPath;
}
/**
* Get imageWebPath
*
* @return string
*/
public function getImageWebPath()
{
return $this->imageWebPath;
}
/**
* set invoice
*
*
* @return SupplierInvoices
*/
public function setInvoice(Invoices $invoice = null)
{
$this->invoice= $invoice;
return $this;
}
/**
* Get invoice
*
* @return \App\Entity\Invoices
*/
public function getInvoice()
{
return $this->invoice;
}
/**
* Set issuer
*
*
* @return SupplierInvoices
*/
public function setIssuer(\App\Entity\Companies $issuer = null)
{
$this->issuer = $issuer;
return $this;
}
/**
* Get issuer
*
* @return \App\Entity\Companies
*/
public function getIssuer()
{
return $this->issuer;
}
/**
* set trafficViolation
*
*
* @return SupplierInvoices
*/
public function setTrafficViolation(VehicleTrafficViolations $trafficViolation = null)
{
$this->trafficViolation= $trafficViolation;
return $this;
}
/**
* Get trafficViolation
*
* @return \VehicleTrafficViolations
*/
public function getTrafficViolation()
{
return $this->trafficViolation;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return SupplierInvoices
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set createdBy
*
*
* @return SupplierInvoices
*/
public function setCreatedBy(Users $createdBy = null)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return \Users
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Set updatedAt
*
* @param \DateTime $updatedAt
*
* @return SupplierInvoices
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set updatedBy
*
*
* @return SupplierInvoices
*/
public function setUpdatedBy(Users $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return Users
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* Set vatRate
*
*
* @return SupplierInvoices
*/
public function setVatRate(VatRate $vatRate = null)
{
$this->vatRate = $vatRate;
return $this;
}
/**
* Get vatRate
*
* @return VatRate
*/
public function getVatRate()
{
return $this->vatRate;
}
#[PrePersist]
public function prePersist() {
if ($this->getCreatedAt() == null) {
$this->setCreatedAt(new \DateTime(date('Y-m-d H:i:s')));
}
}
#[PreUpdate]
public function preUpdate() {
$this->setUpdatedAt(new \DateTime(date('Y-m-d H:i:s')));
}
}