<?php
namespace App\Entity;
use App\Entity\Shop;
use App\Entity\Product;
use App\Entity\Purchase;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use App\Repository\OperationRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass=OperationRepository::class)
* @Vich\Uploadable
*/
class Operation
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* @ORM\Column(type="datetime", nullable=true)
* @Gedmo\Timestampable(on="create")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
* @Gedmo\Timestampable(on="update")
*/
private $updatedAt;
/**
* @ORM\OneToMany(targetEntity=Purchase::class, mappedBy="operation")
*/
private $purchases;
/**
* @ORM\OneToMany(targetEntity=Shop::class, mappedBy="operation", cascade={"persist"})
*/
private $shops;
/**
* @ORM\OneToMany(targetEntity=Product::class, mappedBy="operation",cascade={"persist"})
*/
private $products;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $startAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $endAt;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $code;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $openUntil;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $maxParticipations;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $contestDescription;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contestRulesLink;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $contestRulesDescription;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $privacyText;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $presentation;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $logoEmail;
/**
* @Vich\UploadableField(mapping="operation_logo", fileNameProperty="logoEmail")
*
* @var File|null
*/
private $logoEmailFile;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isStop;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isActive = true;
/**
* @ORM\OneToMany(targetEntity=OperationAdditionalData::class, mappedBy="operation",cascade={"persist"})
*/
private $operationAdditionalData;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $bigBanner;
/**
* @Vich\UploadableField(mapping="operation_big_banner", fileNameProperty="bigBanner")
*
* @var File|null
*/
private $bigBannerFile;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $smallBanner;
/**
* @Vich\UploadableField(mapping="operation_small_banner", fileNameProperty="smallBanner")
*
* @var File|null
*/
private $smallBannerFile;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $brand;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $modality;
/**
* @Vich\UploadableField(mapping="operation_modality", fileNameProperty="modality")
*
* @var File|null
*/
private $modalityFile;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $productsFile;
/**
* @ORM\OneToMany(targetEntity=User::class, mappedBy="isBlockedOperation")
*/
private $users;
/**
* @ORM\OneToMany(targetEntity=Fund::class, mappedBy="operation")
*/
private $funds;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $closingSales;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $shops_file;
/**
* @ORM\OneToMany(targetEntity=Mecanique::class, mappedBy="operation", cascade={"persist"})
*/
private $mecaniques;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $url = 'op';
/**
* @ORM\Column(type="array", nullable=true)
*/
private $cible = [];
/**
* @ORM\Column(type="array", nullable=true)
*/
private $justificatifs = [];
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $productMutliple;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $serialNumber;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $textSerialNumber;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $legalNotice;
public function __construct()
{
$this->purchases = new ArrayCollection();
$this->shops = new ArrayCollection();
$this->products = new ArrayCollection();
$this->operationTransferReceivedDates = new ArrayCollection();
$this->operationAcdNumbers = new ArrayCollection();
$this->operationTransferAmounts = new ArrayCollection();
$this->operationAdditionalData = new ArrayCollection();
$this->users = new ArrayCollection();
$this->funds = new ArrayCollection();
$this->mecaniques = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection|Purchase[]
*/
public function getPurchases(): Collection
{
return $this->purchases;
}
public function addPurchases(Purchase $purchase): self
{
if (!$this->purchases->contains($purchase)) {
$this->purchases[] = $purchase;
$purchase->setOperation($this);
}
return $this;
}
public function removePurchases(Purchase $purchase): self
{
if ($this->purchases->contains($purchase)) {
$this->purchases->removeElement($purchase);
// set the owning side to null (unless already changed)
if ($purchase->getOperation() === $this) {
$purchase->setOperation(null);
}
}
return $this;
}
/**
* @return Collection|Shop[]
*/
public function getShops(): Collection
{
return $this->shops;
}
public function addShop(Shop $shop): self
{
if (!$this->shops->contains($shop)) {
$this->shops[] = $shop;
$shop->setOperation($this);
}
return $this;
}
public function removeShop(Shop $shop): self
{
if ($this->shops->contains($shop)) {
$this->shops->removeElement($shop);
// set the owning side to null (unless already changed)
if ($shop->getOperation() === $this) {
$shop->setOperation(null);
}
}
return $this;
}
/**
* @return Collection|Product[]
*/
public function getProducts(): Collection
{
return $this->products;
}
public function addProduct(Product $product): self
{
if (!$this->products->contains($product)) {
$this->products[] = $product;
$product->setOperation($this);
}
return $this;
}
public function removeProduct(Product $product): self
{
if ($this->products->contains($product)) {
$this->products->removeElement($product);
// set the owning side to null (unless already changed)
if ($product->getOperation() === $this) {
$product->setOperation(null);
}
}
return $this;
}
public function getStartAt(): ?\DateTimeInterface
{
return $this->startAt;
}
public function setStartAt(?\DateTimeInterface $startAt): self
{
$this->startAt = $startAt;
return $this;
}
public function getEndAt(): ?\DateTimeInterface
{
return $this->endAt;
}
public function setEndAt(?\DateTimeInterface $endAt): self
{
$this->endAt = $endAt;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(?string $code): self
{
$this->code = $code;
return $this;
}
public function getOpenUntil(): ?\DateTimeInterface
{
return $this->openUntil;
}
public function setOpenUntil(?\DateTimeInterface $openUntil): self
{
$this->openUntil = $openUntil;
return $this;
}
public function getMaxParticipations(): ?int
{
return $this->maxParticipations;
}
public function setMaxParticipations(int $maxParticipations): self
{
$this->maxParticipations = $maxParticipations;
return $this;
}
public function getContestDescription(): ?string
{
return $this->contestDescription;
}
public function setContestDescription(?string $contestDescription): self
{
$this->contestDescription = $contestDescription;
return $this;
}
public function getContestRulesLink(): ?string
{
return $this->contestRulesLink;
}
public function setContestRulesLink(?string $contestRulesLink): self
{
$this->contestRulesLink = $contestRulesLink;
return $this;
}
public function getContestRulesDescription(): ?string
{
return $this->contestRulesDescription;
}
public function setContestRulesDescription(?string $contestRulesDescription): self
{
$this->contestRulesDescription = $contestRulesDescription;
return $this;
}
public function getPrivacyText(): ?string
{
return $this->privacyText;
}
public function setPrivacyText(?string $privacyText): self
{
$this->privacyText = $privacyText;
return $this;
}
public function getPresentation(): ?string
{
return $this->presentation;
}
public function setPresentation(?string $presentation): self
{
$this->presentation = $presentation;
return $this;
}
public function getLogoEmail(): ?string
{
return $this->logoEmail;
}
public function setLogoEmail(?string $logoEmail): self
{
$this->logoEmail = $logoEmail;
return $this;
}
/**
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $logoEmailFile
*/
public function setLogoEmailFile(?File $logoEmail = null): void
{
$this->logoEmailFile = $logoEmail;
if (null !== $logoEmail) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getLogoEmailFile(): ?File
{
return $this->logoEmailFile;
}
public function getIsStop(): ?bool
{
return $this->isStop;
}
public function setIsStop(?bool $isStop): self
{
$this->isStop = $isStop;
return $this;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(?bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
/**
* @return Collection|OperationAdditionalData[]
*/
public function getOperationAdditionalData(): Collection
{
return $this->operationAdditionalData;
}
public function addOperationAdditionalData(OperationAdditionalData $operationAdditionalData): self
{
if (!$this->operationAdditionalData->contains($operationAdditionalData)) {
$this->operationAdditionalData[] = $operationAdditionalData;
$operationAdditionalData->setOperation($this);
}
return $this;
}
public function removeOperationAdditionalData(OperationAdditionalData $operationAdditionalData): self
{
if ($this->operationAdditionalData->removeElement($operationAdditionalData)) {
// set the owning side to null (unless already changed)
if ($operationAdditionalData->getOperation() === $this) {
$operationAdditionalData->setOperation(null);
}
}
return $this;
}
public function getBigBanner(): ?string
{
return $this->bigBanner;
}
public function setBigBanner(?string $bigBanner): self
{
$this->bigBanner = $bigBanner;
return $this;
}
public function getSmallBanner(): ?string
{
return $this->smallBanner;
}
public function setSmallBanner(?string $smallBanner): self
{
$this->smallBanner = $smallBanner;
return $this;
}
/**
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $smallBannerFile
*/
public function setSmallBannerFile(?File $smallBanner = null): void
{
$this->smallBannerFile = $smallBanner;
if (null !== $smallBanner) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getSmallBannerFile(): ?File
{
return $this->smallBannerFile;
}
/**
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $smallBannerFile
*/
public function setBigBannerFile(?File $bigBanner = null): void
{
$this->bigBannerFile = $bigBanner;
if (null !== $bigBanner) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getBigBannerFile(): ?File
{
return $this->bigBannerFile;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function addPurchase(Purchase $purchase): self
{
if (!$this->purchases->contains($purchase)) {
$this->purchases[] = $purchase;
$purchase->setOperation($this);
}
return $this;
}
public function removePurchase(Purchase $purchase): self
{
if ($this->purchases->removeElement($purchase)) {
// set the owning side to null (unless already changed)
if ($purchase->getOperation() === $this) {
$purchase->setOperation(null);
}
}
return $this;
}
public function getBrand(): ?string
{
return $this->brand;
}
public function setBrand(?string $brand): self
{
$this->brand = $brand;
return $this;
}
public function getModality(): ?string
{
return $this->modality;
}
public function setModality(?string $modality): self
{
$this->modality = $modality;
return $this;
}
public function setModalityFile(?File $modality = null): void
{
$this->modalityFile = $modality;
if (null !== $modality) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getModalityFile(): ?File
{
return $this->modalityFile;
}
public function getProductsFile(): ?string
{
return $this->productsFile;
}
public function setProductsFile(?string $productsFile): self
{
$this->productsFile = $productsFile;
return $this;
}
/**
* @return Collection|User[]
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->setIsBlockedOperation($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getIsBlockedOperation() === $this) {
$user->setIsBlockedOperation(null);
}
}
return $this;
}
/**
* @return Collection|Fund[]
*/
public function getFunds(): Collection
{
return $this->funds;
}
public function addFund(Fund $fund): self
{
if (!$this->funds->contains($fund)) {
$this->funds[] = $fund;
$fund->setOperation($this);
}
return $this;
}
public function removeFund(Fund $fund): self
{
if ($this->funds->removeElement($fund)) {
// set the owning side to null (unless already changed)
if ($fund->getOperation() === $this) {
$fund->setOperation(null);
}
}
return $this;
}
public function getClosingSales(): ?bool
{
return $this->closingSales;
}
public function setClosingSales(?bool $closingSales): self
{
$this->closingSales = $closingSales;
return $this;
}
public function getShopsFile(): ?string
{
return $this->shops_file;
}
public function setShopsFile(?string $shops_file): self
{
$this->shops_file = $shops_file;
return $this;
}
/**
* @return Collection<int, Mecanique>
*/
public function getMecaniques(): Collection
{
return $this->mecaniques;
}
public function addMecanique(Mecanique $mecanique): self
{
if (!$this->mecaniques->contains($mecanique)) {
$this->mecaniques[] = $mecanique;
$mecanique->setOperation($this);
}
return $this;
}
public function removeMecanique(Mecanique $mecanique): self
{
if ($this->mecaniques->removeElement($mecanique)) {
// set the owning side to null (unless already changed)
if ($mecanique->getOperation() === $this) {
$mecanique->setOperation(null);
}
}
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getCible(): ?array
{
return $this->cible;
}
public function setCible(?array $cible): self
{
$this->cible = $cible;
return $this;
}
public function getJustificatifs(): ?array
{
return $this->justificatifs;
}
public function setJustificatifs(?array $justificatifs): self
{
$this->justificatifs = $justificatifs;
return $this;
}
public function getProductMutliple(): ?bool
{
return $this->productMutliple;
}
public function setProductMutliple(?bool $productMutliple): self
{
$this->productMutliple = $productMutliple;
return $this;
}
public function getSerialNumber(): ?bool
{
return $this->serialNumber;
}
public function setSerialNumber(?bool $serialNumber): self
{
$this->serialNumber = $serialNumber;
return $this;
}
public function getTextSerialNumber(): ?string
{
return $this->textSerialNumber;
}
public function setTextSerialNumber(?string $textSerialNumber): self
{
$this->textSerialNumber = $textSerialNumber;
return $this;
}
public function getLegalNotice(): ?string
{
return $this->legalNotice;
}
public function setLegalNotice(?string $legalNotice): self
{
$this->legalNotice = $legalNotice;
return $this;
}
}