src/Entity/Operation.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Shop;
  4. use App\Entity\Product;
  5. use App\Entity\Purchase;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. use App\Repository\OperationRepository;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\Common\Collections\ArrayCollection;
  11. use Symfony\Component\HttpFoundation\File\File;
  12. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  13. /**
  14.  * @ORM\Entity(repositoryClass=OperationRepository::class)
  15.  * @Vich\Uploadable
  16.  */
  17. class Operation
  18. {
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\Column(type="string", length=255, nullable=true)
  27.      */
  28.     private $name;
  29.     /**
  30.      * @ORM\Column(type="datetime", nullable=true)
  31.      * @Gedmo\Timestampable(on="create")
  32.      */
  33.     private $createdAt;
  34.     /**
  35.      * @ORM\Column(type="datetime", nullable=true)
  36.      * @Gedmo\Timestampable(on="update")
  37.      */
  38.     private $updatedAt;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity=Purchase::class, mappedBy="operation")
  41.      */
  42.     private $purchases;
  43.     /**
  44.      * @ORM\OneToMany(targetEntity=Shop::class, mappedBy="operation", cascade={"persist"})
  45.      */
  46.     private $shops;
  47.     /**
  48.      * @ORM\OneToMany(targetEntity=Product::class, mappedBy="operation",cascade={"persist"})
  49.      */
  50.     private $products;
  51.     /**
  52.      * @ORM\Column(type="datetime", nullable=true)
  53.      */
  54.     private $startAt;
  55.     /**
  56.      * @ORM\Column(type="datetime", nullable=true)
  57.      */
  58.     private $endAt;
  59.     /**
  60.      * @ORM\Column(type="string", length=255, nullable=true)
  61.      */
  62.     private $code;
  63.     /**
  64.      * @ORM\Column(type="datetime", nullable=true)
  65.      */
  66.     private $openUntil;
  67.     /**
  68.      * @ORM\Column(type="integer", nullable=true)
  69.      */
  70.     private $maxParticipations;
  71.     /**
  72.      * @ORM\Column(type="text", nullable=true)
  73.      */
  74.     private $contestDescription;
  75.     /**
  76.      * @ORM\Column(type="string", length=255, nullable=true)
  77.      */
  78.     private $contestRulesLink;
  79.     /**
  80.      * @ORM\Column(type="text", nullable=true)
  81.      */
  82.     private $contestRulesDescription;
  83.     /**
  84.      * @ORM\Column(type="text", nullable=true)
  85.      */
  86.     private $privacyText;
  87.     /**
  88.      * @ORM\Column(type="text", nullable=true)
  89.      */
  90.     private $presentation;
  91.     /**
  92.      * @ORM\Column(type="string", length=255, nullable=true)
  93.      */
  94.     private $logoEmail;
  95.     /**
  96.      * @Vich\UploadableField(mapping="operation_logo", fileNameProperty="logoEmail")
  97.      * 
  98.      * @var File|null
  99.      */
  100.     private $logoEmailFile;
  101.     /**
  102.      * @ORM\Column(type="boolean", nullable=true)
  103.      */
  104.     private $isStop;
  105.     /**
  106.      * @ORM\Column(type="boolean", nullable=true)
  107.      */
  108.     private $isActive true;
  109.     /**
  110.      * @ORM\OneToMany(targetEntity=OperationAdditionalData::class, mappedBy="operation",cascade={"persist"})
  111.      */
  112.     private $operationAdditionalData;
  113.     /**
  114.      * @ORM\Column(type="string", length=255, nullable=true)
  115.      */
  116.     private $bigBanner;
  117.     /**
  118.      * @Vich\UploadableField(mapping="operation_big_banner", fileNameProperty="bigBanner")
  119.      * 
  120.      * @var File|null
  121.      */
  122.     private $bigBannerFile;
  123.     /**
  124.      * @ORM\Column(type="string", length=255, nullable=true)
  125.      */
  126.     private $smallBanner;
  127.     /**
  128.      * @Vich\UploadableField(mapping="operation_small_banner", fileNameProperty="smallBanner")
  129.      * 
  130.      * @var File|null
  131.      */
  132.     private $smallBannerFile;
  133.     /**
  134.      * @ORM\Column(type="string", length=255, nullable=true)
  135.      */
  136.     private $brand;
  137.     /**
  138.      * @ORM\Column(type="string", length=255, nullable=true)
  139.      */
  140.     private $modality;
  141.     /**
  142.      * @Vich\UploadableField(mapping="operation_modality", fileNameProperty="modality")
  143.      * 
  144.      * @var File|null
  145.      */
  146.     private $modalityFile;
  147.     /**
  148.      * @ORM\Column(type="string", length=255, nullable=true)
  149.      */
  150.     private $productsFile;
  151.     /**
  152.      * @ORM\OneToMany(targetEntity=User::class, mappedBy="isBlockedOperation")
  153.      */
  154.     private $users;
  155.     /**
  156.      * @ORM\OneToMany(targetEntity=Fund::class, mappedBy="operation")
  157.      */
  158.     private $funds;
  159.     /**
  160.      * @ORM\Column(type="boolean", nullable=true)
  161.      */
  162.     private $closingSales;
  163.     /**
  164.      * @ORM\Column(type="string", length=255, nullable=true)
  165.      */
  166.     private $shops_file;
  167.     /**
  168.      * @ORM\OneToMany(targetEntity=Mecanique::class, mappedBy="operation", cascade={"persist"})
  169.      */
  170.     private $mecaniques;
  171.     /**
  172.      * @ORM\Column(type="string", length=255, nullable=true)
  173.      */
  174.     private $url 'op';
  175.     /**
  176.      * @ORM\Column(type="array", nullable=true)
  177.      */
  178.     private $cible = [];
  179.     /**
  180.      * @ORM\Column(type="array", nullable=true)
  181.      */
  182.     private $justificatifs = [];
  183.     /**
  184.      * @ORM\Column(type="boolean", nullable=true)
  185.      */
  186.     private $productMutliple;
  187.     /**
  188.      * @ORM\Column(type="boolean", nullable=true)
  189.      */
  190.     private $serialNumber;
  191.     /**
  192.      * @ORM\Column(type="string", length=255, nullable=true)
  193.      */
  194.     private $textSerialNumber;
  195.     /**
  196.      * @ORM\Column(type="string", length=255, nullable=true)
  197.      */
  198.     private $legalNotice;
  199.     public function __construct()
  200.     {
  201.         $this->purchases = new ArrayCollection();
  202.         $this->shops = new ArrayCollection();
  203.         $this->products = new ArrayCollection();
  204.         $this->operationTransferReceivedDates = new ArrayCollection();
  205.         $this->operationAcdNumbers = new ArrayCollection();
  206.         $this->operationTransferAmounts = new ArrayCollection();
  207.         $this->operationAdditionalData = new ArrayCollection();
  208.         $this->users = new ArrayCollection();
  209.         $this->funds = new ArrayCollection();
  210.         $this->mecaniques = new ArrayCollection();
  211.     }
  212.     public function getId(): ?int
  213.     {
  214.         return $this->id;
  215.     }
  216.     public function getName(): ?string
  217.     {
  218.         return $this->name;
  219.     }
  220.     public function setName(string $name): self
  221.     {
  222.         $this->name $name;
  223.         return $this;
  224.     }
  225.     /**
  226.      * @return Collection|Purchase[]
  227.      */
  228.     public function getPurchases(): Collection
  229.     {
  230.         return $this->purchases;
  231.     }
  232.     public function addPurchases(Purchase $purchase): self
  233.     {
  234.         if (!$this->purchases->contains($purchase)) {
  235.             $this->purchases[] = $purchase;
  236.             $purchase->setOperation($this);
  237.         }
  238.         return $this;
  239.     }
  240.     public function removePurchases(Purchase $purchase): self
  241.     {
  242.         if ($this->purchases->contains($purchase)) {
  243.             $this->purchases->removeElement($purchase);
  244.             // set the owning side to null (unless already changed)
  245.             if ($purchase->getOperation() === $this) {
  246.                 $purchase->setOperation(null);
  247.             }
  248.         }
  249.         return $this;
  250.     }
  251.     /**
  252.      * @return Collection|Shop[]
  253.      */
  254.     public function getShops(): Collection
  255.     {
  256.         return $this->shops;
  257.     }
  258.     public function addShop(Shop $shop): self
  259.     {
  260.         if (!$this->shops->contains($shop)) {
  261.             $this->shops[] = $shop;
  262.             $shop->setOperation($this);
  263.         }
  264.         return $this;
  265.     }
  266.     public function removeShop(Shop $shop): self
  267.     {
  268.         if ($this->shops->contains($shop)) {
  269.             $this->shops->removeElement($shop);
  270.             // set the owning side to null (unless already changed)
  271.             if ($shop->getOperation() === $this) {
  272.                 $shop->setOperation(null);
  273.             }
  274.         }
  275.         return $this;
  276.     }
  277.     /**
  278.      * @return Collection|Product[]
  279.      */
  280.     public function getProducts(): Collection
  281.     {
  282.         return $this->products;
  283.     }
  284.     public function addProduct(Product $product): self
  285.     {
  286.         if (!$this->products->contains($product)) {
  287.             $this->products[] = $product;
  288.             $product->setOperation($this);
  289.         }
  290.         return $this;
  291.     }
  292.     public function removeProduct(Product $product): self
  293.     {
  294.         if ($this->products->contains($product)) {
  295.             $this->products->removeElement($product);
  296.             // set the owning side to null (unless already changed)
  297.             if ($product->getOperation() === $this) {
  298.                 $product->setOperation(null);
  299.             }
  300.         }
  301.         return $this;
  302.     }
  303.     public function getStartAt(): ?\DateTimeInterface
  304.     {
  305.         return $this->startAt;
  306.     }
  307.     public function setStartAt(?\DateTimeInterface $startAt): self
  308.     {
  309.         $this->startAt $startAt;
  310.         return $this;
  311.     }
  312.     public function getEndAt(): ?\DateTimeInterface
  313.     {
  314.         return $this->endAt;
  315.     }
  316.     public function setEndAt(?\DateTimeInterface $endAt): self
  317.     {
  318.         $this->endAt $endAt;
  319.         return $this;
  320.     }
  321.     public function getCode(): ?string
  322.     {
  323.         return $this->code;
  324.     }
  325.     public function setCode(?string $code): self
  326.     {
  327.         $this->code $code;
  328.         return $this;
  329.     }
  330.     public function getOpenUntil(): ?\DateTimeInterface
  331.     {
  332.         return $this->openUntil;
  333.     }
  334.     public function setOpenUntil(?\DateTimeInterface $openUntil): self
  335.     {
  336.         $this->openUntil $openUntil;
  337.         return $this;
  338.     }
  339.     public function getMaxParticipations(): ?int
  340.     {
  341.         return $this->maxParticipations;
  342.     }
  343.     public function setMaxParticipations(int $maxParticipations): self
  344.     {
  345.         $this->maxParticipations $maxParticipations;
  346.         return $this;
  347.     }
  348.     public function getContestDescription(): ?string
  349.     {
  350.         return $this->contestDescription;
  351.     }
  352.     public function setContestDescription(?string $contestDescription): self
  353.     {
  354.         $this->contestDescription $contestDescription;
  355.         return $this;
  356.     }
  357.     public function getContestRulesLink(): ?string
  358.     {
  359.         return $this->contestRulesLink;
  360.     }
  361.     public function setContestRulesLink(?string $contestRulesLink): self
  362.     {
  363.         $this->contestRulesLink $contestRulesLink;
  364.         return $this;
  365.     }
  366.     public function getContestRulesDescription(): ?string
  367.     {
  368.         return $this->contestRulesDescription;
  369.     }
  370.     public function setContestRulesDescription(?string $contestRulesDescription): self
  371.     {
  372.         $this->contestRulesDescription $contestRulesDescription;
  373.         return $this;
  374.     }
  375.     public function getPrivacyText(): ?string
  376.     {
  377.         return $this->privacyText;
  378.     }
  379.     public function setPrivacyText(?string $privacyText): self
  380.     {
  381.         $this->privacyText $privacyText;
  382.         return $this;
  383.     }
  384.     public function getPresentation(): ?string
  385.     {
  386.         return $this->presentation;
  387.     }
  388.     public function setPresentation(?string $presentation): self
  389.     {
  390.         $this->presentation $presentation;
  391.         return $this;
  392.     }
  393.     public function getLogoEmail(): ?string
  394.     {
  395.         return $this->logoEmail;
  396.     }
  397.     public function setLogoEmail(?string $logoEmail): self
  398.     {
  399.         $this->logoEmail $logoEmail;
  400.         return $this;
  401.     }
  402.     /**
  403.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $logoEmailFile
  404.      */
  405.     public function setLogoEmailFile(?File $logoEmail null): void
  406.     {
  407.         $this->logoEmailFile $logoEmail;
  408.         if (null !== $logoEmail) {
  409.             // It is required that at least one field changes if you are using doctrine
  410.             // otherwise the event listeners won't be called and the file is lost
  411.             $this->updatedAt = new \DateTimeImmutable();
  412.         }
  413.     }
  414.     public function getLogoEmailFile(): ?File
  415.     {
  416.         return $this->logoEmailFile;
  417.     }
  418.     public function getIsStop(): ?bool
  419.     {
  420.         return $this->isStop;
  421.     }
  422.     public function setIsStop(?bool $isStop): self
  423.     {
  424.         $this->isStop $isStop;
  425.         return $this;
  426.     }
  427.     public function getIsActive(): ?bool
  428.     {
  429.         return $this->isActive;
  430.     }
  431.     public function setIsActive(?bool $isActive): self
  432.     {
  433.         $this->isActive $isActive;
  434.         return $this;
  435.     }
  436.     /**
  437.      * @return Collection|OperationAdditionalData[]
  438.      */
  439.     public function getOperationAdditionalData(): Collection
  440.     {
  441.         return $this->operationAdditionalData;
  442.     }
  443.     public function addOperationAdditionalData(OperationAdditionalData $operationAdditionalData): self
  444.     {
  445.         if (!$this->operationAdditionalData->contains($operationAdditionalData)) {
  446.             $this->operationAdditionalData[] = $operationAdditionalData;
  447.             $operationAdditionalData->setOperation($this);
  448.         }
  449.         return $this;
  450.     }
  451.     public function removeOperationAdditionalData(OperationAdditionalData $operationAdditionalData): self
  452.     {
  453.         if ($this->operationAdditionalData->removeElement($operationAdditionalData)) {
  454.             // set the owning side to null (unless already changed)
  455.             if ($operationAdditionalData->getOperation() === $this) {
  456.                 $operationAdditionalData->setOperation(null);
  457.             }
  458.         }
  459.         return $this;
  460.     }
  461.     public function getBigBanner(): ?string
  462.     {
  463.         return $this->bigBanner;
  464.     }
  465.     public function setBigBanner(?string $bigBanner): self
  466.     {
  467.         $this->bigBanner $bigBanner;
  468.         return $this;
  469.     }
  470.     public function getSmallBanner(): ?string
  471.     {
  472.         return $this->smallBanner;
  473.     }
  474.     public function setSmallBanner(?string $smallBanner): self
  475.     {
  476.         $this->smallBanner $smallBanner;
  477.         return $this;
  478.     }
  479.     /**
  480.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $smallBannerFile
  481.      */
  482.     public function setSmallBannerFile(?File $smallBanner null): void
  483.     {
  484.         $this->smallBannerFile $smallBanner;
  485.         if (null !== $smallBanner) {
  486.             // It is required that at least one field changes if you are using doctrine
  487.             // otherwise the event listeners won't be called and the file is lost
  488.             $this->updatedAt = new \DateTimeImmutable();
  489.         }
  490.     }
  491.     public function getSmallBannerFile(): ?File
  492.     {
  493.         return $this->smallBannerFile;
  494.     }
  495.     /**
  496.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $smallBannerFile
  497.      */
  498.     public function setBigBannerFile(?File $bigBanner null): void
  499.     {
  500.         $this->bigBannerFile $bigBanner;
  501.         if (null !== $bigBanner) {
  502.             // It is required that at least one field changes if you are using doctrine
  503.             // otherwise the event listeners won't be called and the file is lost
  504.             $this->updatedAt = new \DateTimeImmutable();
  505.         }
  506.     }
  507.     public function getBigBannerFile(): ?File
  508.     {
  509.         return $this->bigBannerFile;
  510.     }
  511.     public function getCreatedAt(): ?\DateTimeInterface
  512.     {
  513.         return $this->createdAt;
  514.     }
  515.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  516.     {
  517.         $this->createdAt $createdAt;
  518.         return $this;
  519.     }
  520.     public function getUpdatedAt(): ?\DateTimeInterface
  521.     {
  522.         return $this->updatedAt;
  523.     }
  524.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  525.     {
  526.         $this->updatedAt $updatedAt;
  527.         return $this;
  528.     }
  529.     public function addPurchase(Purchase $purchase): self
  530.     {
  531.         if (!$this->purchases->contains($purchase)) {
  532.             $this->purchases[] = $purchase;
  533.             $purchase->setOperation($this);
  534.         }
  535.         return $this;
  536.     }
  537.     public function removePurchase(Purchase $purchase): self
  538.     {
  539.         if ($this->purchases->removeElement($purchase)) {
  540.             // set the owning side to null (unless already changed)
  541.             if ($purchase->getOperation() === $this) {
  542.                 $purchase->setOperation(null);
  543.             }
  544.         }
  545.         return $this;
  546.     }
  547.     public function getBrand(): ?string
  548.     {
  549.         return $this->brand;
  550.     }
  551.     public function setBrand(?string $brand): self
  552.     {
  553.         $this->brand $brand;
  554.         return $this;
  555.     }
  556.     public function getModality(): ?string
  557.     {
  558.         return $this->modality;
  559.     }
  560.     public function setModality(?string $modality): self
  561.     {
  562.         $this->modality $modality;
  563.         return $this;
  564.     }
  565.     public function setModalityFile(?File $modality null): void
  566.     {
  567.         $this->modalityFile $modality;
  568.         if (null !== $modality) {
  569.             // It is required that at least one field changes if you are using doctrine
  570.             // otherwise the event listeners won't be called and the file is lost
  571.             $this->updatedAt = new \DateTimeImmutable();
  572.         }
  573.     }
  574.     public function getModalityFile(): ?File
  575.     {
  576.         return $this->modalityFile;
  577.     }
  578.     public function getProductsFile(): ?string
  579.     {
  580.         return $this->productsFile;
  581.     }
  582.     public function setProductsFile(?string $productsFile): self
  583.     {
  584.         $this->productsFile $productsFile;
  585.         return $this;
  586.     }
  587.     /**
  588.      * @return Collection|User[]
  589.      */
  590.     public function getUsers(): Collection
  591.     {
  592.         return $this->users;
  593.     }
  594.     public function addUser(User $user): self
  595.     {
  596.         if (!$this->users->contains($user)) {
  597.             $this->users[] = $user;
  598.             $user->setIsBlockedOperation($this);
  599.         }
  600.         return $this;
  601.     }
  602.     public function removeUser(User $user): self
  603.     {
  604.         if ($this->users->removeElement($user)) {
  605.             // set the owning side to null (unless already changed)
  606.             if ($user->getIsBlockedOperation() === $this) {
  607.                 $user->setIsBlockedOperation(null);
  608.             }
  609.         }
  610.         return $this;
  611.     }
  612.     /**
  613.      * @return Collection|Fund[]
  614.      */
  615.     public function getFunds(): Collection
  616.     {
  617.         return $this->funds;
  618.     }
  619.     public function addFund(Fund $fund): self
  620.     {
  621.         if (!$this->funds->contains($fund)) {
  622.             $this->funds[] = $fund;
  623.             $fund->setOperation($this);
  624.         }
  625.         return $this;
  626.     }
  627.     public function removeFund(Fund $fund): self
  628.     {
  629.         if ($this->funds->removeElement($fund)) {
  630.             // set the owning side to null (unless already changed)
  631.             if ($fund->getOperation() === $this) {
  632.                 $fund->setOperation(null);
  633.             }
  634.         }
  635.         return $this;
  636.     }
  637.     public function getClosingSales(): ?bool
  638.     {
  639.         return $this->closingSales;
  640.     }
  641.     public function setClosingSales(?bool $closingSales): self
  642.     {
  643.         $this->closingSales $closingSales;
  644.         return $this;
  645.     }
  646.     public function getShopsFile(): ?string
  647.     {
  648.         return $this->shops_file;
  649.     }
  650.     public function setShopsFile(?string $shops_file): self
  651.     {
  652.         $this->shops_file $shops_file;
  653.         return $this;
  654.     }
  655.     /**
  656.      * @return Collection<int, Mecanique>
  657.      */
  658.     public function getMecaniques(): Collection
  659.     {
  660.         return $this->mecaniques;
  661.     }
  662.     public function addMecanique(Mecanique $mecanique): self
  663.     {
  664.         if (!$this->mecaniques->contains($mecanique)) {
  665.             $this->mecaniques[] = $mecanique;
  666.             $mecanique->setOperation($this);
  667.         }
  668.         return $this;
  669.     }
  670.     public function removeMecanique(Mecanique $mecanique): self
  671.     {
  672.         if ($this->mecaniques->removeElement($mecanique)) {
  673.             // set the owning side to null (unless already changed)
  674.             if ($mecanique->getOperation() === $this) {
  675.                 $mecanique->setOperation(null);
  676.             }
  677.         }
  678.         return $this;
  679.     }
  680.     public function getUrl(): ?string
  681.     {
  682.         return $this->url;
  683.     }
  684.     public function setUrl(?string $url): self
  685.     {
  686.         $this->url $url;
  687.         return $this;
  688.     }
  689.     public function getCible(): ?array
  690.     {
  691.         return $this->cible;
  692.     }
  693.     public function setCible(?array $cible): self
  694.     {
  695.         $this->cible $cible;
  696.         return $this;
  697.     }
  698.     public function getJustificatifs(): ?array
  699.     {
  700.         return $this->justificatifs;
  701.     }
  702.     public function setJustificatifs(?array $justificatifs): self
  703.     {
  704.         $this->justificatifs $justificatifs;
  705.         return $this;
  706.     }    
  707.     public function getProductMutliple(): ?bool
  708.     {
  709.         return $this->productMutliple;
  710.     }
  711.     public function setProductMutliple(?bool $productMutliple): self
  712.     {
  713.         $this->productMutliple $productMutliple;
  714.         return $this;
  715.     }
  716.     public function getSerialNumber(): ?bool
  717.     {
  718.         return $this->serialNumber;
  719.     }
  720.     public function setSerialNumber(?bool $serialNumber): self
  721.     {
  722.         $this->serialNumber $serialNumber;
  723.         return $this;
  724.     }
  725.     public function getTextSerialNumber(): ?string
  726.     {
  727.         return $this->textSerialNumber;
  728.     }
  729.     public function setTextSerialNumber(?string $textSerialNumber): self
  730.     {
  731.         $this->textSerialNumber $textSerialNumber;
  732.         return $this;
  733.     }
  734.     public function getLegalNotice(): ?string
  735.     {
  736.         return $this->legalNotice;
  737.     }
  738.     public function setLegalNotice(?string $legalNotice): self
  739.     {
  740.         $this->legalNotice $legalNotice;
  741.         return $this;
  742.     }
  743. }