src/Entity/Company.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. //use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Entity\Category;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use Serializable;
  10. use Doctrine\Common\Collections\Collection;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. #[ORM\Table(name'company')]
  13. #[ORM\Entity(repositoryClass'App\Repository\CompanyRepository')]
  14. class Company extends User
  15. {
  16.     public function __construct()
  17.     {
  18.         $this->categories = new ArrayCollection();
  19.         $this->productclicks = new ArrayCollection();
  20.         $this->visites = new ArrayCollection();
  21.         $this->companyFavCompanies = new ArrayCollection();
  22.         $this->products = new ArrayCollection();
  23.     }
  24.     #[ORM\Id]
  25.     #[Groups(['company''category'"favorite"])]
  26.     #[ORM\GeneratedValue(strategy'AUTO')]
  27.     #[ORM\Column(name'id'type'integer'uniquetrue)]
  28.     protected $id;
  29.     #[Groups(['company''category'"favorite"])]
  30.     #[ORM\Column(name'name'type'string'length255)]
  31.     protected $name;
  32.     #[Groups(['company''category'])]
  33.     #[ORM\Column(name'certification'type'string'length255nullabletrue)]
  34.     protected $certification;
  35.     #[Groups(['company''category'])]
  36.     #[ORM\ManyToMany(targetEntity'App\Entity\Category'inversedBy'companies'cascade: ['persist'], fetch'EAGER')]
  37.     #[ORM\JoinTable(name'company_category')]
  38.     private $categories;
  39.     #[Groups(['company''category'])]
  40.     #[ORM\Column(name'niveau'type'string'nullablefalse)]
  41.     private $niveau;
  42.     #[Groups(['company''category'])]
  43.     #[ORM\Column(name'influencezone'type'string'length255)]
  44.     protected $influencezone;
  45.     #[Groups(['company''category'])]
  46.     #[ORM\Column(name'street'type'string'length255)]
  47.     protected $street;
  48.     #[Groups(['company''category'])]
  49.     #[ORM\Column(name'streetnumber'type'string'nullabletrue)]
  50.     protected $streetnumber;
  51.     #[Groups(['company''category'])]
  52.     #[ORM\Column(name'postcode'type'string')]
  53.     protected $postcode;
  54.     #[Groups(['company''category'])]
  55.     #[ORM\Column(name'city'type'string'length255)]
  56.     protected $city;
  57.     #[Groups(['company''category'])]
  58.     #[ORM\Column(name'region'type'string'length255)]
  59.     protected $region;
  60.     #[Groups(['company''category'])]
  61.     #[ORM\Column(name'country'type'string'length255)]
  62.     protected $country;
  63.     #[Groups(['company''category'])]
  64.     #[ORM\Column(name'phone'type'string'length255)]
  65.     protected $phone;
  66.     #[Groups(['company''category'])]
  67.     #[ORM\Column(name'wantevaluation'type'boolean')]
  68.     protected $wantevaluation;
  69.     #[Groups(['company''category'])]
  70.     #[ORM\Column(name'description'type'text')]
  71.     protected $description;
  72.     #[Groups(['company''category'])]
  73.     #[ORM\Column(name'vision'type'text')]
  74.     protected $vision;
  75.     #[Groups(['company''category'])]
  76.     #[ORM\Column(name'socialreason'type'text')]
  77.     protected $socialreason;
  78.     #[Groups(['company'])]
  79.     #[ORM\Column(name'urlwebsite'type'string'length255nullabletrue)]
  80.     protected $urlwebsite;
  81.     #[Groups(['company'])]
  82.     #[ORM\Column(name'urlfacebook'type'string'length255nullabletrue)]
  83.     protected $urlfacebook;
  84.     #[Groups(['company'])]
  85.     #[ORM\Column(name'urltwitter'type'string'length255nullabletrue)]
  86.     protected $urltwitter;
  87.     #[Groups(['company'])]
  88.     #[ORM\Column(name'urllinkedin'type'string'length255nullabletrue)]
  89.     protected $urllinkedin;
  90.     #[Groups(['company''category'])]
  91.     #[ORM\Column(name'slug'type'string'length255)]
  92.     protected $slug;
  93.     #[Groups(['company''category'])]
  94.     #[ORM\Column(name'starting_date'type'string'nullabletrue)]
  95.     protected $startingdate;
  96.     #[ORM\OneToMany(targetEntityProductClick::class, mappedBy'company'cascade: ['persist'], orphanRemovaltrue)]
  97.     #[Groups(['company''category'])]
  98.     private $productclicks;
  99.     #[Groups(['company''category'])]
  100.     #[ORM\Column(name'package'type'smallint'nullabletrue)]
  101.     protected $package;
  102.     #[Groups(['company''category'"favorite"])]
  103.     #[ORM\Column(name'image'nullabletruetype'string')]
  104.     protected $image;
  105.   #[ORM\Column(type'float')]
  106.   #[Groups(['company''category'])]
  107.   private $latitude;
  108.   #[ORM\Column(type'float')]
  109.   #[Groups(['company''category'])]
  110.   private $longtitude;
  111.   #[ORM\OneToMany(targetEntity'CompanyFav'mappedBy'company')]
  112.   #[Groups(['company''category'])]
  113.   private $companyFavCompanies;
  114.   #[ORM\OneToMany(targetEntity'Visite'mappedBy'company')]
  115.   #[Groups(['company''category'])]
  116.   private $visites;
  117.     /**
  118.      * @return string
  119.      */
  120.     public function getNiveau()
  121.     {
  122.         return $this->niveau;
  123.     }
  124.     /**
  125.      * @param string $niveau
  126.      */
  127.     public function setNiveau($niveau)
  128.     {
  129.         $this->niveau $niveau;
  130.     }
  131.     /**
  132.      * @return Collection|Visite[]
  133.      */
  134.     public function getVisites(): Collection
  135.     {
  136.         return $this->visites;
  137.     }
  138.     public function addVisite(Visite $visite): self
  139.     {
  140.         if (!$this->visites->contains($visite)) {
  141.             $this->visites[] = $visite;
  142.             $visite->setCompany($this);
  143.         }
  144.         return $this;
  145.     }
  146.     public function removeVisite(Visite $visite): self
  147.     {
  148.         if ($this->visites->removeElement($visite)) {
  149.             // set the owning side to null (unless already changed)
  150.             if ($visite->getCompany() === $this) {
  151.                 $visite->setCompany(null);
  152.             }
  153.         }
  154.         return $this;
  155.     }
  156.     /**
  157.      * @return Collection|ProductClick[]
  158.      */
  159.     public function getProductclicks(): Collection
  160.     {
  161.         return $this->productclicks;
  162.     }
  163.     public function addProductclick(ProductClick $productclick): self
  164.     {
  165.         if (!$this->productclicks->contains($productclick)) {
  166.             $this->productclicks[] = $productclick;
  167.             $productclick->setCompany($this);
  168.         }
  169.         return $this;
  170.     }
  171.     public function removeProductclick(ProductClick $productclick): self
  172.     {
  173.         if ($this->cartlines->removeElement($productclick)) {
  174.             // set the owning side to null (unless already changed)
  175.             if ($productclick->getCompany() === $this) {
  176.                 $productclick->setCompany(null);
  177.             }
  178.         }
  179.         return $this;
  180.     }
  181.     /**
  182.      * @return boolean
  183.      */
  184.     public function isWantevaluation()
  185.     {
  186.         return $this->wantevaluation;
  187.     }
  188.     /**
  189.      * @param boolean $wantevaluation
  190.      */
  191.     public function setWantevaluation($wantevaluation)
  192.     {
  193.         $this->wantevaluation $wantevaluation;
  194.     }
  195.     /**
  196.      * @return date
  197.      */
  198.     public function getCertification()
  199.     {
  200.         return $this->certification;
  201.     }
  202.     /**
  203.      * @param date $certification
  204.      */
  205.     public function setCertification($certification)
  206.     {
  207.         $this->certification $certification;
  208.     }
  209.     /**
  210.      * @return \DateTime
  211.      */
  212.     public function getstartingdate()
  213.     {
  214.         return $this->startingdate;
  215.     }
  216.     /**
  217.      * @param \DateTime $startingdate
  218.      */
  219.     public function setstartingdate($startingdate)
  220.     {
  221.         $this->startingdate $startingdate;
  222.     }
  223.     /**
  224.      * @return text
  225.      */
  226.     public function getDescription()
  227.     {
  228.         return $this->description;
  229.     }
  230.     /**
  231.      * @param text $description
  232.      */
  233.     public function setDescription($description)
  234.     {
  235.         $this->description $description;
  236.     }
  237.     /**
  238.      * @return int
  239.      */
  240.     public function getId()
  241.     {
  242.         return $this->id;
  243.     }
  244.     /**
  245.      * @param int $id
  246.      */
  247.     public function setId($id)
  248.     {
  249.         $this->id $id;
  250.     }
  251.     /**
  252.      * @return string
  253.      */
  254.     public function getInfluencezone()
  255.     {
  256.         return $this->influencezone;
  257.     }
  258.     /**
  259.      * @param string $influencezone
  260.      */
  261.     public function setInfluencezone($influencezone)
  262.     {
  263.         $this->influencezone $influencezone;
  264.     }
  265.     /**
  266.      * @return string
  267.      */
  268.     public function getName()
  269.     {
  270.         return $this->name;
  271.     }
  272.     /**
  273.      * @param string $name
  274.      */
  275.     public function setName($name)
  276.     {
  277.         $this->name $name;
  278.     }
  279.     /**
  280.      * @return string
  281.      */
  282.     public function getSlug()
  283.     {
  284.         return $this->slug;
  285.     }
  286.     /**
  287.      * @param string $slug
  288.      */
  289.     public function setSlug($slug)
  290.     {
  291.         $this->slug $slug;
  292.     }
  293.     /**
  294.      * @return text
  295.      */
  296.     public function getSocialreason()
  297.     {
  298.         return $this->socialreason;
  299.     }
  300.     /**
  301.      * @param text $socialreason
  302.      */
  303.     public function setSocialreason($socialreason)
  304.     {
  305.         $this->socialreason $socialreason;
  306.     }
  307.     /**
  308.      * @return string
  309.      */
  310.     public function getUrlfacebook()
  311.     {
  312.         return $this->urlfacebook;
  313.     }
  314.     /**
  315.      * @param string $urlfacebook
  316.      */
  317.     public function setUrlfacebook($urlfacebook)
  318.     {
  319.         $this->urlfacebook $urlfacebook;
  320.     }
  321.     /**
  322.      * @return string
  323.      */
  324.     public function getUrllinkedin()
  325.     {
  326.         return $this->urllinkedin;
  327.     }
  328.     /**
  329.      * @param string $urllinkedin
  330.      */
  331.     public function setUrllinkedin($urllinkedin)
  332.     {
  333.         $this->urllinkedin $urllinkedin;
  334.     }
  335.     /**
  336.      * @return string
  337.      */
  338.     public function getUrltwitter()
  339.     {
  340.         return $this->urltwitter;
  341.     }
  342.     /**
  343.      * @param string $urltwitter
  344.      */
  345.     public function setUrltwitter($urltwitter)
  346.     {
  347.         $this->urltwitter $urltwitter;
  348.     }
  349.     /**
  350.      * @return string
  351.      */
  352.     public function getUrlwebsite()
  353.     {
  354.         return $this->urlwebsite;
  355.     }
  356.     /**
  357.      * @param string $urlwebsite
  358.      */
  359.     public function setUrlwebsite($urlwebsite)
  360.     {
  361.         $this->urlwebsite $urlwebsite;
  362.     }
  363.     /**
  364.      * @return text
  365.      */
  366.     public function getVision()
  367.     {
  368.         return $this->vision;
  369.     }
  370.     /**
  371.      * @param text $vision
  372.      */
  373.     public function setVision($vision)
  374.     {
  375.         $this->vision $vision;
  376.     }
  377.     public function getCategories()
  378.     {
  379.         return $this->categories;
  380.     }
  381.     /*public function setCategory(Category $category)
  382.     {
  383.         $this->categories = $categories;
  384.         return $this;
  385.     } */
  386.     /**
  387.      * @return smallint
  388.      */
  389.     public function getPackage()
  390.     {
  391.         return $this->package;
  392.     }
  393.     /**
  394.      * @param smallint $package
  395.      */
  396.     public function setPackage($package)
  397.     {
  398.         $this->package $package;
  399.     }
  400.     /**
  401.      * @return string
  402.      */
  403.     public function getStreet()
  404.     {
  405.         return $this->street;
  406.     }
  407.     /**
  408.      * @param string $street
  409.      */
  410.     public function setStreet($street)
  411.     {
  412.         $this->street $street;
  413.     }
  414.     /**
  415.      * @return string
  416.      */
  417.     public function getStreetnumber()
  418.     {
  419.         return $this->streetnumber;
  420.     }
  421.     /**
  422.      * @param string $streetnumber
  423.      */
  424.     public function setStreetnumber($streetnumber)
  425.     {
  426.         $this->streetnumber $streetnumber;
  427.     }
  428.     /**
  429.      * @return smallint
  430.      */
  431.     public function getPostcode()
  432.     {
  433.         return $this->postcode;
  434.     }
  435.     /**
  436.      * @param smallint $postcode
  437.      */
  438.     public function setPostcode($postcode)
  439.     {
  440.         $this->postcode $postcode;
  441.     }
  442.     /**
  443.      * @return string
  444.      */
  445.     public function getCity()
  446.     {
  447.         return $this->city;
  448.     }
  449.     /**
  450.      * @param string $city
  451.      */
  452.     public function setCity($city)
  453.     {
  454.         $this->city $city;
  455.     }
  456.     /**
  457.      * @return string
  458.      */
  459.     public function getRegion()
  460.     {
  461.         return $this->region;
  462.     }
  463.     /**
  464.      * @param string $region
  465.      */
  466.     public function setRegion($region)
  467.     {
  468.         $this->region $region;
  469.     }
  470.     /**
  471.      * @return string
  472.      */
  473.     public function getCountry()
  474.     {
  475.         return $this->country;
  476.     }
  477.     /**
  478.      * @param string $country
  479.      */
  480.     public function setCountry($country)
  481.     {
  482.         $this->country $country;
  483.     }
  484.     /**
  485.      * @return string
  486.      */
  487.     public function getPhone()
  488.     {
  489.         return $this->phone;
  490.     }
  491.     /**
  492.      * @param string $phone
  493.      */
  494.     public function setPhone($phone)
  495.     {
  496.         $this->phone $phone;
  497.     }
  498.     /**
  499.      * @return bool
  500.      */
  501.     public function isActived()
  502.     {
  503.         return $this->actived;
  504.     }
  505.     /**
  506.      * @param bool $actived
  507.      */
  508.     public function setActived($actived)
  509.     {
  510.         $this->actived $actived;
  511.     }
  512.     /**
  513.      * @return string
  514.      */
  515.     public function getImage()
  516.     {
  517.         return $this->image;
  518.     }
  519.     /* @param string $image
  520.      * @return mixed
  521.      */
  522.     public function setImage($image)
  523.     {
  524.         $this->image $image;
  525.         return $this;
  526.     }
  527.     #[ORM\OneToMany(targetEntityProduct::class, mappedBy'company'orphanRemovaltrue)]
  528.     #[Groups(['company''category'])]
  529.     private $products;
  530.     #[ORM\Column(type'boolean')]
  531.     #[Groups(['company''category'])]
  532.     private $activated false;
  533.     /**
  534.      * @return Collection|CompanyFav[]
  535.      */
  536.     public function getCompanyFavCompanies(): Collection
  537.     {
  538.         return $this->companyFavCompanies;
  539.     }
  540.     public function addCompanyFavCompany(CompanyFav $compfav): self
  541.     {
  542.         if (!$this->companyFavCompanies->contains($compfav)) {
  543.             $this->companyFavCompanies[] = $compfav;
  544.             $compfav->setCompany($this);
  545.         }
  546.         return $this;
  547.     }
  548.     public function removeCompanyFavCompany(CompanyFav $compfav): self
  549.     {
  550.         if ($this->companyFavCompanies->removeElement($compfav)) {
  551.             // set the owning side to null (unless already changed)
  552.             if ($compfav->getCompany() === $this) {
  553.                 $compfav->setCompany(null);
  554.             }
  555.         }
  556.         return $this;
  557.     }
  558.     public function getWantevaluation(): ?bool
  559.     {
  560.         return $this->wantevaluation;
  561.     }
  562.     public function addCategory(Category $category): self
  563.     {
  564.         if (!$this->categories->contains($category)) {
  565.             $this->categories[] = $category;
  566.         }
  567.         return $this;
  568.     }
  569.     public function removeCategory(Category $category): self
  570.     {
  571.         $this->categories->removeElement($category);
  572.         return $this;
  573.     }
  574.     public function getLatitude(): ?float
  575.     {
  576.         return $this->latitude;
  577.     }
  578.     public function setLatitude(float $latitude): self
  579.     {
  580.         $this->latitude $latitude;
  581.         return $this;
  582.     }
  583.     public function getLongtitude(): ?float
  584.     {
  585.         return $this->longtitude;
  586.     }
  587.     public function setLongtitude(float $longtitude): self
  588.     {
  589.         $this->longtitude $longtitude;
  590.         return $this;
  591.     }
  592.     /**
  593.      * @return Collection|Product[]
  594.      */
  595.     public function getProducts(): Collection
  596.     {
  597.         return $this->products;
  598.     }
  599.     public function addProduct(Product $product): self
  600.     {
  601.         if (!$this->products->contains($product)) {
  602.             $this->products[] = $product;
  603.             $product->setCompany($this);
  604.         }
  605.         return $this;
  606.     }
  607.     public function removeProduct(Product $product): self
  608.     {
  609.         if ($this->products->removeElement($product)) {
  610.             // set the owning side to null (unless already changed)
  611.             if ($product->getCompany() === $this) {
  612.                 $product->setCompany(null);
  613.             }
  614.         }
  615.         return $this;
  616.     }
  617.     public function getActivated(): ?bool
  618.     {
  619.         return $this->activated;
  620.     }
  621.     public function setActivated(bool $activated): self
  622.     {
  623.         $this->activated $activated;
  624.         return $this;
  625.     }
  626. }