src/Entity/Shop.php line 18

  1. <?php
  2. namespace App\Entity;
  3. use Vich\UploadableField;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Repository\ShopRepository;
  7. use Doctrine\Common\Collections\Collection;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  12. use Symfony\Component\HttpFoundation\File\UploadedFile;
  13. #[ORM\Entity(repositoryClassShopRepository::class)]
  14. #[Vich\Uploadable]
  15. class Shop
  16. {
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column]
  20.     #[Groups("shop_browse")]
  21.     private ?int $id null;
  22.     #[ORM\Column(type'string'length50)]
  23.     #[Groups("shop_browse")]
  24.     private ?string $name null;
  25.     #[ORM\Column(length255nullabletrue)]
  26.     private ?string $email null;
  27.     #[ORM\Column(length255)]
  28.     private ?string $subtitle null;
  29.     #[ORM\Column(length20nullabletrue)]
  30.     private ?string $phoneNumber null;
  31.     #[ORM\Column(typeTypes::TEXT)]
  32.     private ?string $about null;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     #[Groups("shop_browse")]
  35.     private ?string $adressStreet null;
  36.     #[ORM\Column(length255nullabletrue)]
  37.     private ?string $adressStreet2 null;
  38.     #[ORM\Column(length6nullabletrue)]
  39.     #[Groups("shop_browse")]
  40.     private ?int $addressPostalCode null;
  41.     #[ORM\Column(length255nullabletrue)]
  42.     #[Groups("shop_browse")]
  43.     private ?string $addressCity null;
  44.     // START IMAGE 1
  45.     #[Vich\UploadableField(mapping'shop_images'fileNameProperty'imageName')]
  46.     private ?File $picture1 null;
  47.     #[ORM\Column(nullabletrue)]
  48.     #[Groups("shop_browse")]
  49.     private ?string $imageName null;
  50.     // START IMAGE 2
  51.     #[Vich\UploadableField(mapping'shop_images2'fileNameProperty'imageName2')]
  52.     private ?File $picture2 null;
  53.     #[ORM\Column(nullabletrue)]
  54.     private ?string $imageName2 null;
  55.     // START IMAGE 3
  56.     #[Vich\UploadableField(mapping'shop_images3'fileNameProperty'imageName3')]
  57.     private ?File $picture3 null;
  58.     #[ORM\Column(nullabletrue)]
  59.     private ?string $imageName3 null;
  60.     // START IMAGE 4
  61.     #[Vich\UploadableField(mapping'shop_images4'fileNameProperty'imageName4')]
  62.     private ?File $picture4 null;
  63.     #[ORM\Column(nullabletrue)]
  64.     private ?string $imageName4 null;
  65.     // START IMAGE 5
  66.     #[Vich\UploadableField(mapping'shop_images5'fileNameProperty'imageName5')]
  67.     private ?File $picture5 null;
  68.     #[ORM\Column(nullabletrue)]
  69.     private ?string $imageName5 null;
  70.     // START IMAGE 6
  71.     #[Vich\UploadableField(mapping'shop_images6'fileNameProperty'imageName6')]
  72.     private ?File $picture6 null;
  73.     #[ORM\Column(nullabletrue)]
  74.     private ?string $imageName6 null;
  75.     #[ORM\Column(length255nullabletrue)]
  76.     private ?string $facebook null;
  77.     #[ORM\Column(length255nullabletrue)]
  78.     private ?string $twitter null;
  79.     #[ORM\Column(length255nullabletrue)]
  80.     private ?string $instagram null;
  81.     #[ORM\Column(length255nullabletrue)]
  82.     private ?string $linkedin null;
  83.     #[ORM\Column(length255nullabletrue)]
  84.     private ?string $website null;
  85.     #[ORM\Column]
  86.     private ?bool $available null;
  87.     #[ORM\Column]
  88.     private ?bool $verified null;
  89.     #[ORM\Column(nullabletrue)]
  90.     private ?int $homepagePlace null;
  91.     #[ORM\Column(length255nullabletrue)]
  92.     private ?string $slug null;
  93.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  94.     private ?\DateTimeInterface $createdAt null;
  95.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  96.     private ?\DateTimeInterface $updatedAt null;
  97.     #[ORM\Column(nullabletrue)]
  98.     #[Groups("shop_browse")]
  99.     private ?float $latitude null;
  100.     #[ORM\Column(nullabletrue)]
  101.     #[Groups("shop_browse")]
  102.     private ?float $longitude null;
  103.     #[ORM\Column(nullabletrue)]
  104.     #[Groups("shop_browse")]
  105.     private ?string $myBusiness null;
  106.     // inversedBy
  107.     #[ORM\ManyToMany(targetEntityCategory::class, inversedBy'shops'cascade: ["persist"])]
  108.     #[Groups("shop_browse")]
  109.     private Collection $categories;
  110.     //#[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'shops', cascade: ["persist"])]
  111.     //private Collection $users;
  112.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'shops'cascade: ["persist"])]
  113.     #[Groups("shop_browse")]
  114.     private ?User $users null;
  115.     #[ORM\ManyToMany(targetEntityTags::class, inversedBy'Shops'cascade: ["persist"])]
  116.     private Collection $tags;
  117.     public function __construct()
  118.     {
  119.         $this->categories = new ArrayCollection();
  120.         $this->tags = new ArrayCollection();
  121.         //$this->users = new ArrayCollection();
  122.     }
  123.     public function add()
  124.     {
  125.         $this->categories = new ArrayCollection();
  126.         $this->tags = new ArrayCollection();
  127.     }
  128.     public function getId(): ?int
  129.     {
  130.         return $this->id;
  131.     }
  132.     public function getName(): ?string
  133.     {
  134.         return $this->name;
  135.     }
  136.     public function setName(string $name): self
  137.     {
  138.         $this->name $name;
  139.         return $this;
  140.     }
  141.     public function getEmail(): ?string
  142.     {
  143.         return $this->email;
  144.     }
  145.     public function setEmail(?string $email): self
  146.     {
  147.         $this->email $email;
  148.         return $this;
  149.     }
  150.     public function getSubtitle(): ?string
  151.     {
  152.         return $this->subtitle;
  153.     }
  154.     public function setSubtitle(string $subtitle): self
  155.     {
  156.         $this->subtitle $subtitle;
  157.         return $this;
  158.     }
  159.     public function getPhoneNumber(): ?string
  160.     {
  161.         return $this->phoneNumber;
  162.     }
  163.     public function setPhoneNumber(string $phoneNumber): self
  164.     {
  165.         $this->phoneNumber $phoneNumber;
  166.         return $this;
  167.     }
  168.     public function getAbout(): ?string
  169.     {
  170.         return $this->about;
  171.     }
  172.     public function setAbout(string $about): self
  173.     {
  174.         $this->about $about;
  175.         return $this;
  176.     }
  177.     public function getAdressStreet(): ?string
  178.     {
  179.         return $this->adressStreet;
  180.     }
  181.     public function setAdressStreet(string $adressStreet): self
  182.     {
  183.         $this->adressStreet $adressStreet;
  184.         return $this;
  185.     }
  186.     public function getAdressStreet2(): ?string
  187.     {
  188.         return $this->adressStreet2;
  189.     }
  190.     public function setAdressStreet2(string $adressStreet2): self
  191.     {
  192.         $this->adressStreet2 $adressStreet2;
  193.         return $this;
  194.     }
  195.     public function getAddressPostalCode(): ?int
  196.     {
  197.         return $this->addressPostalCode;
  198.     }
  199.     public function setAddressPostalCode(int $addressPostalCode): self
  200.     {
  201.         $this->addressPostalCode $addressPostalCode;
  202.         return $this;
  203.     }
  204.     public function getAddressCity(): ?string
  205.     {
  206.         return $this->addressCity;
  207.     }
  208.     public function setAddressCity(string $addressCity): self
  209.     {
  210.         $this->addressCity $addressCity;
  211.         return $this;
  212.     }
  213.     // PICTURE 1 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
  214.     /**
  215.      *
  216.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture1
  217.      */
  218.     public function setPicture1(?File $picture1 null): void
  219.     {
  220.         $this->picture1 $picture1;
  221.         if (null !== $picture1) {
  222.             // It is required that at least one field changes if you are using doctrine
  223.             // otherwise the event listeners won't be called and the file is lost
  224.             $this->updatedAt = new \DateTimeImmutable();
  225.         }
  226.     }
  227.     public function getPicture1(): ?File
  228.     {
  229.         return $this->picture1;
  230.     }
  231.     public function setImageName(?string $imageName): void
  232.     {
  233.         $this->imageName $imageName;
  234.     }
  235.     public function getImageName(): ?string
  236.     {
  237.         return $this->imageName;
  238.     }
  239. // PICTURE 2 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
  240.     /**
  241.      *
  242.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture2
  243.      */
  244.     public function setPicture2(?File $picture2 null): void
  245.     {
  246.         $this->picture2 $picture2;
  247.         if (null !== $picture2) {
  248.             // It is required that at least one field changes if you are using doctrine
  249.             // otherwise the event listeners won't be called and the file is lost
  250.             $this->updatedAt = new \DateTimeImmutable();
  251.         }
  252.     }
  253.     public function getPicture2(): ?File
  254.     {
  255.         return $this->picture2;
  256.     }
  257.     public function setImageName2(?string $imageName2): void
  258.     {
  259.         $this->imageName2 $imageName2;
  260.     }
  261.     public function getImageName2(): ?string
  262.     {
  263.         return $this->imageName2;
  264.     }
  265. // PICTURE 3 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
  266.     /**
  267.      *
  268.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture3
  269.      */
  270.     public function setPicture3(?File $picture3 null): void
  271.     {
  272.         $this->picture3 $picture3;
  273.         if (null !== $picture3) {
  274.             // It is required that at least one field changes if you are using doctrine
  275.             // otherwise the event listeners won't be called and the file is lost
  276.             $this->updatedAt = new \DateTimeImmutable();
  277.         }
  278.     }
  279.     public function getPicture3(): ?File
  280.     {
  281.         return $this->picture3;
  282.     }
  283.     public function setImageName3(?string $imageName3): void
  284.     {
  285.         $this->imageName3 $imageName3;
  286.     }
  287.     public function getImageName3(): ?string
  288.     {
  289.         return $this->imageName3;
  290.     }
  291.     // PICTURE 4 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
  292.     /**
  293.      *
  294.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture4
  295.      */
  296.     public function setPicture4(?File $picture4 null): void
  297.     {
  298.         $this->picture4 $picture4;
  299.         if (null !== $picture4) {
  300.             // It is required that at least one field changes if you are using doctrine
  301.             // otherwise the event listeners won't be called and the file is lost
  302.             $this->updatedAt = new \DateTimeImmutable();
  303.         }
  304.     }
  305.     public function getPicture4(): ?File
  306.     {
  307.         return $this->picture4;
  308.     }
  309.     public function setImageName4(?string $imageName4): void
  310.     {
  311.         $this->imageName4 $imageName4;
  312.     }
  313.     public function getImageName4(): ?string
  314.     {
  315.         return $this->imageName4;
  316.     }
  317. // PICTURE 5 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
  318.     /**
  319.      *
  320.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture5
  321.      */
  322.     public function setPicture5(?File $picture5 null): void
  323.     {
  324.         $this->picture5 $picture5;
  325.         if (null !== $picture5) {
  326.             // It is required that at least one field changes if you are using doctrine
  327.             // otherwise the event listeners won't be called and the file is lost
  328.             $this->updatedAt = new \DateTimeImmutable();
  329.         }
  330.     }
  331.     public function getPicture5(): ?File
  332.     {
  333.         return $this->picture5;
  334.     }
  335.     public function setImageName5(?string $imageName5): void
  336.     {
  337.         $this->imageName5 $imageName5;
  338.     }
  339.     public function getImageName5(): ?string
  340.     {
  341.         return $this->imageName5;
  342.     }
  343.     // PICTURE 6 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
  344.     /**
  345.      *
  346.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture6
  347.      */
  348.     public function setPicture6(?File $picture6 null): void
  349.     {
  350.         $this->picture6 $picture6;
  351.         if (null !== $picture6) {
  352.             // It is required that at least one field changes if you are using doctrine
  353.             // otherwise the event listeners won't be called and the file is lost
  354.             $this->updatedAt = new \DateTimeImmutable();
  355.         }
  356.     }
  357.     public function getPicture6(): ?File
  358.     {
  359.         return $this->picture6;
  360.     }
  361.     public function setImageName6(?string $imageName6): void
  362.     {
  363.         $this->imageName6 $imageName6;
  364.     }
  365.     public function getImageName6(): ?string
  366.     {
  367.         return $this->imageName6;
  368.     }
  369.     // END OF USE VICH
  370.     
  371.     public function getFacebook(): ?string
  372.     {
  373.         return $this->facebook;
  374.     }
  375.     public function setFacebook(?string $facebook): self
  376.     {
  377.         $this->facebook $facebook;
  378.         return $this;
  379.     }
  380.     public function getTwitter(): ?string
  381.     {
  382.         return $this->twitter;
  383.     }
  384.     public function setTwitter(?string $twitter): self
  385.     {
  386.         $this->twitter $twitter;
  387.         return $this;
  388.     }
  389.     public function getInstagram(): ?string
  390.     {
  391.         return $this->instagram;
  392.     }
  393.     public function setInstagram(?string $instagram): self
  394.     {
  395.         $this->instagram $instagram;
  396.         return $this;
  397.     }
  398.     public function getLinkedin(): ?string
  399.     {
  400.         return $this->linkedin;
  401.     }
  402.     public function setLinkedin(?string $linkedin): self
  403.     {
  404.         $this->linkedin $linkedin;
  405.         return $this;
  406.     }
  407.     public function getWebsite(): ?string
  408.     {
  409.         return $this->website;
  410.     }
  411.     public function setWebsite(?string $website): self
  412.     {
  413.         $this->website $website;
  414.         return $this;
  415.     }
  416.     public function isAvailable(): ?bool
  417.     {
  418.         return $this->available;
  419.     }
  420.     public function setAvailable(bool $available): self
  421.     {
  422.         $this->available $available;
  423.         return $this;
  424.     }
  425.     public function isVerified(): ?bool
  426.     {
  427.         return $this->verified;
  428.     }
  429.     public function setVerified(bool $verified): self
  430.     {
  431.         $this->verified $verified;
  432.         return $this;
  433.     }
  434.     public function getHomepagePlace(): ?int
  435.     {
  436.         return $this->homepagePlace;
  437.     }
  438.     public function setHomepagePlace(?int $homepagePlace): self
  439.     {
  440.         $this->homepagePlace $homepagePlace;
  441.         return $this;
  442.     }
  443.     public function getSlug(): ?string
  444.     {
  445.         return $this->slug;
  446.     }
  447.     public function setSlug(?string $slug): self
  448.     {
  449.         $this->slug $slug;
  450.         return $this;
  451.     }
  452.     /**
  453.      * @return Collection<int, Category>
  454.      */
  455.     public function getCategories(): Collection
  456.     {
  457.         return $this->categories;
  458.     }
  459.     public function addCategory(Category $category): self
  460.     {
  461.         if (!$this->categories->contains($category)) {
  462.             $this->categories->add($category);
  463.             $category->addShop($this);
  464.         }
  465.         return $this;
  466.     }
  467.     public function removeCategory(Category $category): self
  468.     {
  469.         $this->categories->removeElement($category);
  470.         return $this;
  471.     }
  472.     public function __toString()
  473.     {
  474.         return $this->name;
  475.     }
  476.     public function getCreatedAt(): ?\DateTimeInterface
  477.     {
  478.         return $this->createdAt;
  479.     }
  480.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  481.     {
  482.         $this->createdAt $createdAt;
  483.         return $this;
  484.     }
  485.     public function getUpdatedAt(): ?\DateTimeInterface
  486.     {
  487.         return $this->updatedAt;
  488.     }
  489.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  490.     {
  491.         $this->updatedAt $updatedAt;
  492.         return $this;
  493.     }
  494.     public function getLatitude(): ?float
  495.     {
  496.         return $this->latitude;
  497.     }
  498.     public function setLatitude(?float $latitude): self
  499.     {
  500.         $this->latitude $latitude;
  501.         return $this;
  502.     }
  503.     public function getLongitude(): ?float
  504.     {
  505.         return $this->longitude;
  506.     }
  507.     public function setLongitude(?float $longitude): self
  508.     {
  509.         $this->longitude $longitude;
  510.         return $this;
  511.     }
  512.     public function getUsers(): ?User
  513.     {
  514.         return $this->users;
  515.     }
  516.     public function setUsers(?User $users): self
  517.     {
  518.         $this->users $users;
  519.         return $this;
  520.     }
  521.     /**
  522.      * Get the value of myBusiness
  523.      */
  524.     public function getMyBusiness(): ?string
  525.     {
  526.         return $this->myBusiness;
  527.     }
  528.     /**
  529.      * Set the value of myBusiness
  530.      */
  531.     public function setMyBusiness(?string $myBusiness): self
  532.     {
  533.         $this->myBusiness $myBusiness;
  534.         return $this;
  535.     }
  536.     /**
  537.      * @return Collection<int, Tags>
  538.      */
  539.     public function getTags(): Collection
  540.     {
  541.         return $this->tags;
  542.     }
  543.     public function addTag(Tags $tag): self
  544.     {
  545.         if (!$this->tags->contains($tag)) {
  546.             $this->tags->add($tag);
  547.             $tag->addShop($this);
  548.         }
  549.         return $this;
  550.     }
  551.     public function removeTag(Tags $tag): self
  552.     {
  553.         if ($this->tags->removeElement($tag)) {
  554.             $tag->removeShop($this);
  555.         }
  556.         return $this;
  557.     }
  558. }