<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\OperationRepository")
*/
class Operation
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="datetime")
*/
private $date_operation;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $ref_op;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\SousJacent", inversedBy="operations")
* @ORM\JoinColumn(onDelete="CASCADE")
*/
private $sous_jacent;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $vol_op;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Unite", inversedBy="operations")
* @ORM\JoinColumn(onDelete="CASCADE")
*/
private $unite;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $destinantion;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $delai;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $montant_transaction;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Devise", inversedBy="operations")
* @ORM\JoinColumn(onDelete="CASCADE")
*/
private $devise;
/**
* @ORM\Column(type="datetime")
*/
private $created_at;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\AdminDonneurOrdre", inversedBy="operations")
* @ORM\JoinColumn(onDelete="CASCADE")
*/
private $vendeur;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Status", inversedBy="operations")
* @ORM\JoinColumn(onDelete="CASCADE")
*/
private $status;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Incoterm", inversedBy="operations")
* @ORM\JoinColumn(onDelete="CASCADE")
*/
private $base;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\ModeDeTransport", inversedBy="operations")
* @ORM\JoinColumn(onDelete="CASCADE")
*/
private $mode_de_transport;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\AdminDonneurOrdre", inversedBy="operationAcheteur")
*/
private $acheteur;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $date_execution;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $lia;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Products", inversedBy="operations")
*/
private $filiere;
public function __construct()
{
$this->created_at = new \DateTime('now');
if (!isset($this->ref_op)) {
$this->ref_op = 'OP' . random_int(1, 900) . date('s');
} else {
$this->ref_op = 'OP' . random_int(1, 900) . date('s');
}
}
public function getId(): ?int
{
return $this->id;
}
public function getDateOperation(): ?\DateTimeInterface
{
return $this->date_operation;
}
public function setDateOperation(\DateTimeInterface $date_operation): self
{
$this->date_operation = $date_operation;
return $this;
}
public function getRefOp(): ?string
{
return $this->ref_op;
}
public function setRefOp(?string $ref_op): self
{
$this->ref_op = $ref_op;
return $this;
}
public function getSousJacent(): ?SousJacent
{
return $this->sous_jacent;
}
public function setSousJacent(?SousJacent $sous_jacent): self
{
$this->sous_jacent = $sous_jacent;
return $this;
}
public function getVolOp(): ?int
{
return $this->vol_op;
}
public function setVolOp(?int $vol_op): self
{
$this->vol_op = $vol_op;
return $this;
}
public function getUnite(): ?Unite
{
return $this->unite;
}
public function setUnite(?Unite $unite): self
{
$this->unite = $unite;
return $this;
}
public function getDestinantion(): ?string
{
return $this->destinantion;
}
public function setDestinantion(?string $destinantion): self
{
$this->destinantion = $destinantion;
return $this;
}
public function getDelai(): ?string
{
return $this->delai;
}
public function setDelai(?string $delai): self
{
$this->delai = $delai;
return $this;
}
public function getMontantTransaction(): ?int
{
return $this->montant_transaction;
}
public function setMontantTransaction(?int $montant_transaction): self
{
$this->montant_transaction = $montant_transaction;
return $this;
}
public function getDevise(): ?Devise
{
return $this->devise;
}
public function setDevise(?Devise $devise): self
{
$this->devise = $devise;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getVendeur(): ?AdminDonneurOrdre
{
return $this->vendeur;
}
public function setVendeur(?AdminDonneurOrdre $vendeur): self
{
$this->vendeur = $vendeur;
return $this;
}
public function getStatus(): ?Status
{
return $this->status;
}
public function setStatus(?Status $status): self
{
$this->status = $status;
return $this;
}
public function getBase(): ?Incoterm
{
return $this->base;
}
public function setBase(?Incoterm $base): self
{
$this->base = $base;
return $this;
}
public function getModeDeTransport(): ?ModeDeTransport
{
return $this->mode_de_transport;
}
public function setModeDeTransport(?ModeDeTransport $mode_de_transport): self
{
$this->mode_de_transport = $mode_de_transport;
return $this;
}
public function __toString(): string
{
return $this->ref_op;
}
public function getAcheteur(): ?AdminDonneurOrdre
{
return $this->acheteur;
}
public function setAcheteur(?AdminDonneurOrdre $acheteur): self
{
$this->acheteur = $acheteur;
return $this;
}
public function getDateExecution(): ?\DateTimeInterface
{
return $this->date_execution;
}
public function setDateExecution(?\DateTimeInterface $date_execution): self
{
$this->date_execution = $date_execution;
return $this;
}
public function getLia(): ?string
{
return $this->lia;
}
public function setLia(?string $lia): self
{
$this->lia = $lia;
return $this;
}
public function getFiliere(): ?Products
{
return $this->filiere;
}
public function setFiliere(?Products $filiere): self
{
$this->filiere = $filiere;
return $this;
}
}