src/Entity/Shop.php line 18
<?php
namespace App\Entity;
use Vich\UploadableField;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\ShopRepository;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\HttpFoundation\File\File;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Serializer\Annotation\Groups;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\HttpFoundation\File\UploadedFile;
#[ORM\Entity(repositoryClass: ShopRepository::class)]
#[Vich\Uploadable]
class Shop
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups("shop_browse")]
private ?int $id = null;
#[ORM\Column(type: 'string', length: 50)]
#[Groups("shop_browse")]
private ?string $name = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $email = null;
#[ORM\Column(length: 255)]
private ?string $subtitle = null;
#[ORM\Column(length: 20, nullable: true)]
private ?string $phoneNumber = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $about = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups("shop_browse")]
private ?string $adressStreet = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $adressStreet2 = null;
#[ORM\Column(length: 6, nullable: true)]
#[Groups("shop_browse")]
private ?int $addressPostalCode = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups("shop_browse")]
private ?string $addressCity = null;
// START IMAGE 1
#[Vich\UploadableField(mapping: 'shop_images', fileNameProperty: 'imageName')]
private ?File $picture1 = null;
#[ORM\Column(nullable: true)]
#[Groups("shop_browse")]
private ?string $imageName = null;
// START IMAGE 2
#[Vich\UploadableField(mapping: 'shop_images2', fileNameProperty: 'imageName2')]
private ?File $picture2 = null;
#[ORM\Column(nullable: true)]
private ?string $imageName2 = null;
// START IMAGE 3
#[Vich\UploadableField(mapping: 'shop_images3', fileNameProperty: 'imageName3')]
private ?File $picture3 = null;
#[ORM\Column(nullable: true)]
private ?string $imageName3 = null;
// START IMAGE 4
#[Vich\UploadableField(mapping: 'shop_images4', fileNameProperty: 'imageName4')]
private ?File $picture4 = null;
#[ORM\Column(nullable: true)]
private ?string $imageName4 = null;
// START IMAGE 5
#[Vich\UploadableField(mapping: 'shop_images5', fileNameProperty: 'imageName5')]
private ?File $picture5 = null;
#[ORM\Column(nullable: true)]
private ?string $imageName5 = null;
// START IMAGE 6
#[Vich\UploadableField(mapping: 'shop_images6', fileNameProperty: 'imageName6')]
private ?File $picture6 = null;
#[ORM\Column(nullable: true)]
private ?string $imageName6 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $facebook = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $twitter = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $instagram = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $linkedin = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $website = null;
#[ORM\Column]
private ?bool $available = null;
#[ORM\Column]
private ?bool $verified = null;
#[ORM\Column(nullable: true)]
private ?int $homepagePlace = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $slug = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $createdAt = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $updatedAt = null;
#[ORM\Column(nullable: true)]
#[Groups("shop_browse")]
private ?float $latitude = null;
#[ORM\Column(nullable: true)]
#[Groups("shop_browse")]
private ?float $longitude = null;
#[ORM\Column(nullable: true)]
#[Groups("shop_browse")]
private ?string $myBusiness = null;
// inversedBy
#[ORM\ManyToMany(targetEntity: Category::class, inversedBy: 'shops', cascade: ["persist"])]
#[Groups("shop_browse")]
private Collection $categories;
//#[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'shops', cascade: ["persist"])]
//private Collection $users;
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'shops', cascade: ["persist"])]
#[Groups("shop_browse")]
private ?User $users = null;
#[ORM\ManyToMany(targetEntity: Tags::class, inversedBy: 'Shops', cascade: ["persist"])]
private Collection $tags;
public function __construct()
{
$this->categories = new ArrayCollection();
$this->tags = new ArrayCollection();
//$this->users = new ArrayCollection();
}
public function add()
{
$this->categories = new ArrayCollection();
$this->tags = 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;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getSubtitle(): ?string
{
return $this->subtitle;
}
public function setSubtitle(string $subtitle): self
{
$this->subtitle = $subtitle;
return $this;
}
public function getPhoneNumber(): ?string
{
return $this->phoneNumber;
}
public function setPhoneNumber(string $phoneNumber): self
{
$this->phoneNumber = $phoneNumber;
return $this;
}
public function getAbout(): ?string
{
return $this->about;
}
public function setAbout(string $about): self
{
$this->about = $about;
return $this;
}
public function getAdressStreet(): ?string
{
return $this->adressStreet;
}
public function setAdressStreet(string $adressStreet): self
{
$this->adressStreet = $adressStreet;
return $this;
}
public function getAdressStreet2(): ?string
{
return $this->adressStreet2;
}
public function setAdressStreet2(string $adressStreet2): self
{
$this->adressStreet2 = $adressStreet2;
return $this;
}
public function getAddressPostalCode(): ?int
{
return $this->addressPostalCode;
}
public function setAddressPostalCode(int $addressPostalCode): self
{
$this->addressPostalCode = $addressPostalCode;
return $this;
}
public function getAddressCity(): ?string
{
return $this->addressCity;
}
public function setAddressCity(string $addressCity): self
{
$this->addressCity = $addressCity;
return $this;
}
// PICTURE 1 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
/**
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture1
*/
public function setPicture1(?File $picture1 = null): void
{
$this->picture1 = $picture1;
if (null !== $picture1) {
// 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 getPicture1(): ?File
{
return $this->picture1;
}
public function setImageName(?string $imageName): void
{
$this->imageName = $imageName;
}
public function getImageName(): ?string
{
return $this->imageName;
}
// PICTURE 2 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
/**
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture2
*/
public function setPicture2(?File $picture2 = null): void
{
$this->picture2 = $picture2;
if (null !== $picture2) {
// 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 getPicture2(): ?File
{
return $this->picture2;
}
public function setImageName2(?string $imageName2): void
{
$this->imageName2 = $imageName2;
}
public function getImageName2(): ?string
{
return $this->imageName2;
}
// PICTURE 3 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
/**
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture3
*/
public function setPicture3(?File $picture3 = null): void
{
$this->picture3 = $picture3;
if (null !== $picture3) {
// 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 getPicture3(): ?File
{
return $this->picture3;
}
public function setImageName3(?string $imageName3): void
{
$this->imageName3 = $imageName3;
}
public function getImageName3(): ?string
{
return $this->imageName3;
}
// PICTURE 4 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
/**
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture4
*/
public function setPicture4(?File $picture4 = null): void
{
$this->picture4 = $picture4;
if (null !== $picture4) {
// 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 getPicture4(): ?File
{
return $this->picture4;
}
public function setImageName4(?string $imageName4): void
{
$this->imageName4 = $imageName4;
}
public function getImageName4(): ?string
{
return $this->imageName4;
}
// PICTURE 5 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
/**
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture5
*/
public function setPicture5(?File $picture5 = null): void
{
$this->picture5 = $picture5;
if (null !== $picture5) {
// 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 getPicture5(): ?File
{
return $this->picture5;
}
public function setImageName5(?string $imageName5): void
{
$this->imageName5 = $imageName5;
}
public function getImageName5(): ?string
{
return $this->imageName5;
}
// PICTURE 6 ------ DEBUT DE L'UTILISATION DE VICH ---------------------------
/**
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $picture6
*/
public function setPicture6(?File $picture6 = null): void
{
$this->picture6 = $picture6;
if (null !== $picture6) {
// 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 getPicture6(): ?File
{
return $this->picture6;
}
public function setImageName6(?string $imageName6): void
{
$this->imageName6 = $imageName6;
}
public function getImageName6(): ?string
{
return $this->imageName6;
}
// END OF USE VICH
public function getFacebook(): ?string
{
return $this->facebook;
}
public function setFacebook(?string $facebook): self
{
$this->facebook = $facebook;
return $this;
}
public function getTwitter(): ?string
{
return $this->twitter;
}
public function setTwitter(?string $twitter): self
{
$this->twitter = $twitter;
return $this;
}
public function getInstagram(): ?string
{
return $this->instagram;
}
public function setInstagram(?string $instagram): self
{
$this->instagram = $instagram;
return $this;
}
public function getLinkedin(): ?string
{
return $this->linkedin;
}
public function setLinkedin(?string $linkedin): self
{
$this->linkedin = $linkedin;
return $this;
}
public function getWebsite(): ?string
{
return $this->website;
}
public function setWebsite(?string $website): self
{
$this->website = $website;
return $this;
}
public function isAvailable(): ?bool
{
return $this->available;
}
public function setAvailable(bool $available): self
{
$this->available = $available;
return $this;
}
public function isVerified(): ?bool
{
return $this->verified;
}
public function setVerified(bool $verified): self
{
$this->verified = $verified;
return $this;
}
public function getHomepagePlace(): ?int
{
return $this->homepagePlace;
}
public function setHomepagePlace(?int $homepagePlace): self
{
$this->homepagePlace = $homepagePlace;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection<int, Category>
*/
public function getCategories(): Collection
{
return $this->categories;
}
public function addCategory(Category $category): self
{
if (!$this->categories->contains($category)) {
$this->categories->add($category);
$category->addShop($this);
}
return $this;
}
public function removeCategory(Category $category): self
{
$this->categories->removeElement($category);
return $this;
}
public function __toString()
{
return $this->name;
}
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 getLatitude(): ?float
{
return $this->latitude;
}
public function setLatitude(?float $latitude): self
{
$this->latitude = $latitude;
return $this;
}
public function getLongitude(): ?float
{
return $this->longitude;
}
public function setLongitude(?float $longitude): self
{
$this->longitude = $longitude;
return $this;
}
public function getUsers(): ?User
{
return $this->users;
}
public function setUsers(?User $users): self
{
$this->users = $users;
return $this;
}
/**
* Get the value of myBusiness
*/
public function getMyBusiness(): ?string
{
return $this->myBusiness;
}
/**
* Set the value of myBusiness
*/
public function setMyBusiness(?string $myBusiness): self
{
$this->myBusiness = $myBusiness;
return $this;
}
/**
* @return Collection<int, Tags>
*/
public function getTags(): Collection
{
return $this->tags;
}
public function addTag(Tags $tag): self
{
if (!$this->tags->contains($tag)) {
$this->tags->add($tag);
$tag->addShop($this);
}
return $this;
}
public function removeTag(Tags $tag): self
{
if ($this->tags->removeElement($tag)) {
$tag->removeShop($this);
}
return $this;
}
}