src/Entity/Tariff.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TariffRepository;
  4. use App\Traits\ActivityTrait;
  5. use App\Traits\TimeTrackTrait;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. #[ORM\Entity(repositoryClassTariffRepository::class)]
  11. class Tariff
  12. {
  13.     use TimeTrackTrait;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\ManyToOne(targetEntity"App\Entity\SonataMediaMedia"cascade: ['all'])]
  19.     #[ORM\JoinColumn(name'main_image_id'nullabletrueonDelete'SET NULL')]
  20.     protected $mainImage;
  21.     #[ORM\ManyToOne(targetEntity"App\Entity\SonataMediaMedia"cascade: ['all'])]
  22.     #[ORM\JoinColumn(name'promo_image_id'nullabletrueonDelete'SET NULL')]
  23.     protected $promoImage;
  24.     #[ORM\ManyToOne(targetEntity"App\Entity\SonataMediaMedia"cascade: ['all'])]
  25.     #[ORM\JoinColumn(name'desktop_selection_image_id'nullabletrueonDelete'SET NULL')]
  26.     protected $desktopSelectionImage;
  27.     #[ORM\ManyToOne(targetEntity"App\Entity\SonataMediaMedia"cascade: ['all'])]
  28.     #[ORM\JoinColumn(name'mobile_selection_image_id'nullabletrueonDelete'SET NULL')]
  29.     protected $mobileSelectionImage;
  30.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  31.     private ?string $promoImageUrl null;
  32.     #[ORM\ManyToMany(targetEntity"App\Entity\Company"cascade: ['persist'], orphanRemovalfalse)]
  33.     #[ORM\JoinTable(name'tariffs_promo_image_companies')]
  34.     #[ORM\JoinColumn(name'tariff_id'referencedColumnName'id'onDelete'CASCADE')]
  35.     #[ORM\InverseJoinColumn(name'company_id'referencedColumnName'id'onDelete'CASCADE')]
  36.     private $promoImageCompanies;
  37.     #[ORM\Column(name'active'type'boolean'options: ['default' => 1])]
  38.     private bool $active;
  39.     #[ORM\ManyToMany(targetEntity"App\Entity\Company"inversedBy'tariffs'cascade: ['persist'], orphanRemovalfalse)]
  40.     #[ORM\JoinTable(name'tariffs_companies')]
  41.     #[ORM\JoinColumn(name'tariff_id'referencedColumnName'id'onDelete'CASCADE')]
  42.     #[ORM\InverseJoinColumn(name'company_id'referencedColumnName'id'onDelete'CASCADE')]
  43.     private $companies;
  44.     #[ORM\Column(length191)]
  45.     private ?string $name null;
  46.     #[ORM\Column]
  47.     private ?float $price null;
  48.     #[ORM\Column(name'sale_price'type'float'nullabletrue)]
  49.     private ?float $salePrice null;
  50.     #[ORM\Column(name'in_feed'type'boolean'options: ['default' => 1])]
  51.     private bool $inFeed true;
  52.     #[ORM\Column(name'in_stock'type'boolean'options: ['default' => 1])]
  53.     private bool $inStock true;
  54.     #[ORM\Column(name"info_code"type"text"nullabletrue)]
  55.     private ?string $infoCode null;
  56.     #[ORM\Column(type'string'length191)]
  57.     private ?string $subscription null;
  58.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  59.     private ?string $description null;
  60.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  61.     private ?string $imageLink null;
  62.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  63.     private ?string $apiCode null;
  64.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  65.     private ?string $bottomDescription null;
  66.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  67.     private ?string $shortDescription null;
  68.     #[ORM\Column(name'slug'type'string'length191uniquetruenullabletrue)]
  69.     private $slug;
  70.     #[ORM\Column(type'string'length191nullabletrue)]
  71.     private ?string $reference null;
  72.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  73.     private ?string $shortInfo null;
  74.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  75.     private ?string $detailedInfo null;
  76.     #[ORM\Column(type'string'length191nullabletrue)]
  77.     private ?string $detailsButtonText null;
  78.     #[ORM\Column(type'string'length191nullabletrue)]
  79.     private ?string $detailsButtonUrl null;
  80.     #[ORM\ManyToOne(targetEntityOperator::class, inversedBy'tariffs')]
  81.     #[ORM\JoinColumn(nullablefalse)]
  82.     private ?Operator $operator null;
  83.     #[ORM\OneToMany(mappedBy'tariff'targetEntityPhoneNumber::class, orphanRemovaltrue)]
  84.     private Collection $phoneNumbers;
  85.     public function __construct()
  86.     {
  87.         $this->phoneNumbers = new ArrayCollection();
  88.         $this->companies = new ArrayCollection();
  89.         $this->promoImageCompanies = new ArrayCollection();
  90.     }
  91.     public function getId(): ?int
  92.     {
  93.         return $this->id;
  94.     }
  95.     public function getName(): ?string
  96.     {
  97.         return $this->name;
  98.     }
  99.     public function setName(string $name): static
  100.     {
  101.         $this->name $name;
  102.         return $this;
  103.     }
  104.     public function getPrice(): ?float
  105.     {
  106.         return $this->price;
  107.     }
  108.     public function setPrice(float $price): static
  109.     {
  110.         $this->price $price;
  111.         return $this;
  112.     }
  113.     public function getSalePrice(): ?float
  114.     {
  115.         return $this->salePrice;
  116.     }
  117.     public function setSalePrice(?float $salePrice): static
  118.     {
  119.         $this->salePrice $salePrice;
  120.         return $this;
  121.     }
  122.     public function isInFeed(): bool
  123.     {
  124.         return $this->inFeed;
  125.     }
  126.     public function setInFeed(bool $inFeed): static
  127.     {
  128.         $this->inFeed $inFeed;
  129.         return $this;
  130.     }
  131.     public function isInStock(): bool
  132.     {
  133.         return $this->inStock;
  134.     }
  135.     public function setInStock(bool $inStock): static
  136.     {
  137.         $this->inStock $inStock;
  138.         return $this;
  139.     }
  140.     public function getSubscription(): ?string
  141.     {
  142.         return $this->subscription;
  143.     }
  144.     public function setSubscription(string $subscription): static
  145.     {
  146.         $this->subscription $subscription;
  147.         return $this;
  148.     }
  149.     public function getDescription(): ?string
  150.     {
  151.         return $this->description;
  152.     }
  153.     public function setDescription(?string $description): static
  154.     {
  155.         $this->description $description;
  156.         return $this;
  157.     }
  158.     public function getOperator(): ?Operator
  159.     {
  160.         return $this->operator;
  161.     }
  162.     public function setOperator(?Operator $operator): static
  163.     {
  164.         $this->operator $operator;
  165.         return $this;
  166.     }
  167.     /**
  168.      * @return Collection<int, PhoneNumber>
  169.      */
  170.     public function getPhoneNumbers(): Collection
  171.     {
  172.         return $this->phoneNumbers;
  173.     }
  174.     public function addPhoneNumber(PhoneNumber $phoneNumber): static
  175.     {
  176.         if (!$this->phoneNumbers->contains($phoneNumber)) {
  177.             $this->phoneNumbers->add($phoneNumber);
  178.             $phoneNumber->setTariff($this);
  179.         }
  180.         return $this;
  181.     }
  182.     public function removePhoneNumber(PhoneNumber $phoneNumber): static
  183.     {
  184.         if ($this->phoneNumbers->removeElement($phoneNumber)) {
  185.             // set the owning side to null (unless already changed)
  186.             if ($phoneNumber->getTariff() === $this) {
  187.                 $phoneNumber->setTariff(null);
  188.             }
  189.         }
  190.         return $this;
  191.     }
  192.     /**
  193.      * Set createdAt.
  194.      *
  195.      * @param \DateTime|null $createdAt
  196.      *
  197.      * @return Tariff
  198.      */
  199.     public function setCreatedAt($createdAt null)
  200.     {
  201.         $this->createdAt $createdAt;
  202.         return $this;
  203.     }
  204.     /**
  205.      * Get createdAt.
  206.      *
  207.      * @return \DateTime|null
  208.      */
  209.     public function getCreatedAt()
  210.     {
  211.         return $this->createdAt;
  212.     }
  213.     /**
  214.      * Set updatedAt.
  215.      *
  216.      * @param \DateTime|null $updatedAt
  217.      *
  218.      * @return Tariff
  219.      */
  220.     public function setUpdatedAt($updatedAt null)
  221.     {
  222.         $this->updatedAt $updatedAt;
  223.         return $this;
  224.     }
  225.     /**
  226.      * Get updatedAt.
  227.      *
  228.      * @return \DateTime|null
  229.      */
  230.     public function getUpdatedAt()
  231.     {
  232.         return $this->updatedAt;
  233.     }
  234.     public function getPromoImage(): ?SonataMediaMedia
  235.     {
  236.         return $this->promoImage;
  237.     }
  238.     public function setPromoImage(?SonataMediaMedia $promoImage): static
  239.     {
  240.         $this->promoImage $promoImage;
  241.         return $this;
  242.     }
  243.     public function getPromoImageUrl(): ?string
  244.     {
  245.         return $this->promoImageUrl;
  246.     }
  247.     public function setPromoImageUrl(?string $promoImageUrl): static
  248.     {
  249.         $this->promoImageUrl $promoImageUrl;
  250.         return $this;
  251.     }
  252.     public function getPromoImageCompanies(): Collection
  253.     {
  254.         return $this->promoImageCompanies;
  255.     }
  256.     public function addPromoImageCompany(Company $company): static
  257.     {
  258.         if (!$this->promoImageCompanies->contains($company)) {
  259.             $this->promoImageCompanies->add($company);
  260.         }
  261.         return $this;
  262.     }
  263.     public function removePromoImageCompany(Company $company): static
  264.     {
  265.         $this->promoImageCompanies->removeElement($company);
  266.         return $this;
  267.     }
  268.     public function __toString()
  269.     {
  270.         return $this->getName();
  271.     }
  272.     public function getMainImage(): ?SonataMediaMedia
  273.     {
  274.         return $this->mainImage;
  275.     }
  276.     public function setMainImage(?SonataMediaMedia $mainImage): static
  277.     {
  278.         $this->mainImage $mainImage;
  279.         return $this;
  280.     }
  281.     public function getDesktopSelectionImage(): ?SonataMediaMedia
  282.     {
  283.         return $this->desktopSelectionImage;
  284.     }
  285.     public function setDesktopSelectionImage(?SonataMediaMedia $desktopSelectionImage): static
  286.     {
  287.         $this->desktopSelectionImage $desktopSelectionImage;
  288.         return $this;
  289.     }
  290.     public function getMobileSelectionImage(): ?SonataMediaMedia
  291.     {
  292.         return $this->mobileSelectionImage;
  293.     }
  294.     public function setMobileSelectionImage(?SonataMediaMedia $mobileSelectionImage): static
  295.     {
  296.         $this->mobileSelectionImage $mobileSelectionImage;
  297.         return $this;
  298.     }
  299.     public function getBottomDescription(): ?string
  300.     {
  301.         return $this->bottomDescription;
  302.     }
  303.     public function setBottomDescription(?string $bottomDescription): static
  304.     {
  305.         $this->bottomDescription $bottomDescription;
  306.         return $this;
  307.     }
  308.     public function getShortDescription(): ?string
  309.     {
  310.         return $this->shortDescription;
  311.     }
  312.     public function setShortDescription(?string $shortDescription): static
  313.     {
  314.         $this->shortDescription $shortDescription;
  315.         return $this;
  316.     }
  317.     /**
  318.      * @return Collection<int, Company>
  319.      */
  320.     public function getCompanies(): Collection
  321.     {
  322.         return $this->companies;
  323.     }
  324.     public function addCompany(Company $company): static
  325.     {
  326.         if (!$this->companies->contains($company)) {
  327.             $this->companies->add($company);
  328.         }
  329.         return $this;
  330.     }
  331.     public function removeCompany(Company $company): static
  332.     {
  333.         $this->companies->removeElement($company);
  334.         return $this;
  335.     }
  336.     /**
  337.      * Set active.
  338.      *
  339.      * @param int $active
  340.      *
  341.      * @return Tariff
  342.      */
  343.     public function setActive($active)
  344.     {
  345.         $this->active $active;
  346.         return $this;
  347.     }
  348.     /**
  349.      * Get active.
  350.      *
  351.      * @return int
  352.      */
  353.     public function getActive()
  354.     {
  355.         return $this->active;
  356.     }
  357.     public function isActive(): ?bool
  358.     {
  359.         return $this->active;
  360.     }
  361.     public function getInfoCode(): ?string
  362.     {
  363.         return $this->infoCode;
  364.     }
  365.     public function setInfoCode(?string $infoCode): static
  366.     {
  367.         $this->infoCode $infoCode;
  368.         return $this;
  369.     }
  370.     public function getImageLink(): ?string
  371.     {
  372.         return $this->imageLink;
  373.     }
  374.     public function setImageLink(?string $imageLink): static
  375.     {
  376.         $this->imageLink $imageLink;
  377.         return $this;
  378.     }
  379.     public function getApiCode(): ?string
  380.     {
  381.         return $this->apiCode;
  382.     }
  383.     public function setApiCode(?string $apiCode): static
  384.     {
  385.         $this->apiCode $apiCode;
  386.         return $this;
  387.     }
  388.     public function getSlug(): ?string
  389.     {
  390.         return $this->slug;
  391.     }
  392.     public function setSlug(?string $slug): static
  393.     {
  394.         $this->slug $slug;
  395.         return $this;
  396.     }
  397.     public function getReference(): ?string
  398.     {
  399.         return $this->reference;
  400.     }
  401.     public function setReference(?string $reference): static
  402.     {
  403.         $this->reference $reference;
  404.         return $this;
  405.     }
  406.     public function getShortInfo(): ?string
  407.     {
  408.         return $this->shortInfo;
  409.     }
  410.     public function setShortInfo(?string $shortInfo): static
  411.     {
  412.         $this->shortInfo $shortInfo;
  413.         return $this;
  414.     }
  415.     public function getDetailedInfo(): ?string
  416.     {
  417.         return $this->detailedInfo;
  418.     }
  419.     public function setDetailedInfo(?string $detailedInfo): static
  420.     {
  421.         $this->detailedInfo $detailedInfo;
  422.         return $this;
  423.     }
  424.     public function getDetailsButtonText(): ?string
  425.     {
  426.         return $this->detailsButtonText;
  427.     }
  428.     public function setDetailsButtonText(?string $detailsButtonText): static
  429.     {
  430.         $this->detailsButtonText $detailsButtonText;
  431.         return $this;
  432.     }
  433.     public function getDetailsButtonUrl(): ?string
  434.     {
  435.         return $this->detailsButtonUrl;
  436.     }
  437.     public function setDetailsButtonUrl(?string $detailsButtonUrl): static
  438.     {
  439.         $this->detailsButtonUrl $detailsButtonUrl;
  440.         return $this;
  441.     }
  442. }