src/Entity/Supplier.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SupplierRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use App\Form\EmailType;
  9. /**
  10.  * @ORM\Entity(repositoryClass=SupplierRepository::class)
  11.  */
  12. class Supplier {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=180, nullable=true)
  21.      */
  22.     private $name;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     private $civility;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=true)
  29.      */
  30.     private $nameResponsable ;
  31.     /**
  32.      * @ORM\Column(type="string", length=180, nullable=true)
  33.      * @Assert\Email(
  34.      *     message = "L'adresse email '{{ value }}' n'est pas valide."
  35.      * )
  36.      */
  37.     private $email;
  38.     /**
  39.      * @ORM\Column(type="text", nullable=true)
  40.      */
  41.     private $description;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      */
  45.     private $phone;
  46.     /**
  47.      * @ORM\Column(type="string", length=255, nullable=true)
  48.      */
  49.     private $second_phone;
  50.     /**
  51.      * @ORM\Column(type="text", nullable=true)
  52.      */
  53.     private $adress;
  54.     /**
  55.      * @ORM\Column(type="text", nullable=true)
  56.      */
  57.     private $second_adress;
  58.     /**
  59.      * @ORM\Column(type="string", length=255, nullable=true)
  60.      */
  61.     private $country;
  62.     /**
  63.      * @ORM\Column(type="string", length=255, nullable=true)
  64.      */
  65.     private $region;
  66.     /**
  67.      * @ORM\Column(type="string", length=255, nullable=true)
  68.      */
  69.     private $city;
  70.     /**
  71.      * @ORM\Column(type="string", length=255, nullable=true)
  72.      */
  73.     private $tariff_category;
  74.     /**
  75.      * @ORM\Column(type="string", length=255, nullable=true)
  76.      */
  77.     private $zip;
  78.     /**
  79.      * @ORM\OneToMany(targetEntity=Link::class, mappedBy="supplier")
  80.      */
  81.     private $links;
  82.     /**
  83.      * @ORM\Column(type="datetime")
  84.      */
  85.     private $createdAt;
  86.     /**
  87.      * @ORM\OneToMany(targetEntity=Document::class, mappedBy="supplier")
  88.      */
  89.     private $documents;
  90.     /**
  91.      * @ORM\OneToMany(targetEntity=Address::class, mappedBy="supplier")
  92.      */
  93.     private $multiAddress;
  94.     /**
  95.      * @ORM\Column(type="string", length=255, nullable=true)
  96.      */
  97.     private $type;
  98.     /**
  99.      * @ORM\Column(type="boolean", options={"default": true})
  100.      */
  101.     private bool $isActive true;    
  102.     /**
  103.      * @ORM\Column(type="string", length=255, nullable=true)
  104.      */
  105.     private $raisonSociale;
  106.     /**
  107.      * @ORM\Column(type="string", length=100, nullable=true)
  108.      */
  109.     private $identifiantFiscal;
  110.     /**
  111.      * @ORM\Column(type="string", length=100, nullable=true)
  112.      */
  113.     private $iban;
  114.     /**
  115.      * @ORM\Column(type="string", length=100, nullable=true)
  116.      */
  117.     private $bankName;
  118.     /**
  119.      * @ORM\Column(type="string", length=255, nullable=true)
  120.      */
  121.     private $website;
  122.     /**
  123.      * @ORM\Column(type="string", length=20, nullable=true)
  124.      */
  125.     private $phoneResponsible1;
  126.     /**
  127.      * @ORM\Column(type="string", length=20, nullable=true)
  128.      */
  129.     private $phoneResponsible2;
  130.     /**
  131.      * @ORM\OneToMany(targetEntity=user::class, mappedBy="supplier")
  132.      */
  133.     private $contacts;
  134.     /**
  135.      * @ORM\OneToMany(targetEntity=Comment::class, mappedBy="supplier", cascade={"persist", "remove"})
  136.      */
  137.     private $comments;
  138.     /**
  139.      * @ORM\Column(type="string", length=255, nullable=true)
  140.      */
  141.     private ?string $logo null;
  142.     
  143.     public function __construct()
  144.     {
  145.         $this->links = new ArrayCollection();
  146.         $this->documents = new ArrayCollection();
  147.         $this->multiAddress = new ArrayCollection();
  148.         $this->contacts = new ArrayCollection();
  149.         $this->comments = new ArrayCollection();
  150.     }
  151.     public function getId(): ?int {
  152.         return $this->id;
  153.     }
  154.     public function getName(): ?string {
  155.         return $this->name;
  156.     }
  157.     public function setName(string $name): self {
  158.         $this->name $name;
  159.         return $this;
  160.     }
  161.     public function getCivility(): ?string {
  162.         return $this->civility;
  163.     }
  164.     public function setCivility(string $civility): self {
  165.         $this->civility $civility;
  166.         return $this;
  167.     }
  168.     public function getNameResponsable(): ?string {
  169.         return $this->nameResponsable;
  170.     }
  171.     public function setNameResponsable (string $nameResponsable): self {
  172.         $this->nameResponsable $nameResponsable;
  173.         return $this;
  174.     }
  175.     public function getEmail(): ?string {
  176.         return $this->email;
  177.     }
  178.     public function setEmail(string $email): self {
  179.         $this->email $email;
  180.         return $this;
  181.     }
  182.     public function getDescription(): ?string {
  183.         return $this->description;
  184.     }
  185.     public function setDescription(string $description): self {
  186.         $this->description $description;
  187.         return $this;
  188.     }
  189.     public function getPhone(): ?string {
  190.         return $this->phone;
  191.     }
  192.     public function setPhone(string $phone): self {
  193.         $this->phone $phone;
  194.         return $this;
  195.     }
  196.     public function getSecondPhone(): ?string {
  197.         return $this->second_phone;
  198.     }
  199.     public function setSecondPhone(?string $second_phone): self {
  200.         $this->second_phone $second_phone;
  201.         return $this;
  202.     }
  203.     public function getAdress(): ?string {
  204.         return $this->adress;
  205.     }
  206.     public function setAdress(string $adress): self {
  207.         $this->adress $adress;
  208.         return $this;
  209.     }
  210.     public function getSecondAdress(): ?string {
  211.         return $this->second_adress;
  212.     }
  213.     public function setSecondAdress(?string $second_adress): self {
  214.         $this->second_adress $second_adress;
  215.         return $this;
  216.     }
  217.     public function getCountry(): ?string {
  218.         return $this->country;
  219.     }
  220.     public function setCountry(string $country): self {
  221.         $this->country $country;
  222.         return $this;
  223.     }
  224.     public function getRegion(): ?string {
  225.         return $this->region;
  226.     }
  227.     public function setRegion(string $region): self {
  228.         $this->region $region;
  229.         return $this;
  230.     }
  231.     public function getCity(): ?string {
  232.         return $this->city;
  233.     }
  234.     public function setCity(string $city): self {
  235.         $this->city $city;
  236.         return $this;
  237.     }
  238.     public function getTariffCategory(): ?string {
  239.         return $this->tariff_category;
  240.     }
  241.     public function setTariffCategory(?string $tariff_category): self {
  242.         $this->tariff_category $tariff_category;
  243.         return $this;
  244.     }
  245.     public function getZip(): ?string {
  246.         return $this->zip;
  247.     }
  248.     public function setZip(string $zip): self {
  249.         $this->zip $zip;
  250.         return $this;
  251.     }
  252.      public function getLogo(): ?string 
  253.     
  254.         return $this->logo
  255.     }
  256.     public function setLogo(?string $logo): self 
  257.     
  258.         $this->logo $logo; return $this
  259.     }
  260.     /**
  261.      * @return Collection|Link[]
  262.      */
  263.     public function getLinks(): Collection
  264.     {
  265.         return $this->links;
  266.     }
  267.     public function addLink(Link $link): self
  268.     {
  269.         if( !$this->links->contains($link)) {
  270.             $this->links[] = $link;
  271.             $link->setSupplier($this);
  272.         }
  273.         return $this;
  274.     }
  275.     public function removeLink(Link $link): self
  276.     {
  277.         if( $this->links->removeElement($link)) {
  278.             // set the owning side to null (unless already changed)
  279.             if( $link->getSupplier() === $this) {
  280.                 $link->setSupplier(null);
  281.             }
  282.         }
  283.         return $this;
  284.     }
  285.     public function getCreatedAt(): ?\DateTimeInterface
  286.     {
  287.         return $this->createdAt;
  288.     }
  289.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  290.     {
  291.         $this->createdAt $createdAt;
  292.         return $this;
  293.     }
  294.     public function isActive(): bool
  295.     {
  296.         return $this->isActive;
  297.     }
  298.     public function setIsActive(bool $isActive): self
  299.     {
  300.         $this->isActive $isActive;
  301.         return $this;
  302.     }
  303.     /**
  304.      * @return Collection|Document[]
  305.      */
  306.     public function getDocuments(): Collection
  307.     {
  308.         return $this->documents;
  309.     }
  310.     public function addDocument(Document $document): self
  311.     {
  312.         if( !$this->documents->contains($document)) {
  313.             $this->documents[] = $document;
  314.             $document->setSupplier($this);
  315.         }
  316.         return $this;
  317.     }
  318.     public function removeDocument(Document $document): self
  319.     {
  320.         if( $this->documents->removeElement($document)) {
  321.             // set the owning side to null (unless already changed)
  322.             if( $document->getSupplier() === $this) {
  323.                 $document->setSupplier(null);
  324.             }
  325.         }
  326.         return $this;
  327.     }
  328.     /**
  329.      * @return Collection|Address[]
  330.      */
  331.     public function getMultiAddress(): Collection
  332.     {
  333.         return $this->multiAddress;
  334.     }
  335.     public function addMultiAddress(Address $multiAddress): self
  336.     {
  337.         if( !$this->multiAddress->contains($multiAddress)) {
  338.             $this->multiAddress[] = $multiAddress;
  339.             $multiAddress->setSupplier($this);
  340.         }
  341.         return $this;
  342.     }
  343.     public function removeMultiAddress(Address $multiAddress): self
  344.     {
  345.         if( $this->multiAddress->removeElement($multiAddress)) {
  346.             // set the owning side to null (unless already changed)
  347.             if( $multiAddress->getSupplier() === $this) {
  348.                 $multiAddress->setSupplier(null);
  349.             }
  350.         }
  351.         return $this;
  352.     }
  353.     public function getType(): ?string
  354.     {
  355.         return $this->type;
  356.     }
  357.     public function setType(?string $type): self
  358.     {
  359.         $this->type $type;
  360.         return $this;
  361.     }
  362.     /**
  363.      * @return Collection|user[]
  364.      */
  365.     public function getContacts(): Collection
  366.     {
  367.         return $this->contacts;
  368.     }
  369.     public function addContact(user $contact): self
  370.     {
  371.         if( !$this->contacts->contains($contact)) {
  372.             $this->contacts[] = $contact;
  373.             $contact->setSupplier($this);
  374.         }
  375.         return $this;
  376.     }
  377.     public function removeContact(user $contact): self
  378.     {
  379.         if( $this->contacts->removeElement($contact)) {
  380.             // set the owning side to null (unless already changed)
  381.             if( $contact->getSupplier() === $this) {
  382.                 $contact->setSupplier(null);
  383.             }
  384.         }
  385.         return $this;
  386.     }
  387.     public function getRaisonSociale(): ?string
  388.     {
  389.         return $this->raisonSociale;
  390.     }
  391.     public function setRaisonSociale(?string $raisonSociale): self
  392.     {
  393.         $this->raisonSociale $raisonSociale;
  394.         return $this;
  395.     }
  396.     public function getIdentifiantFiscal(): ?string
  397.     {
  398.         return $this->identifiantFiscal;
  399.     }
  400.     public function setIdentifiantFiscal(?string $identifiantFiscal): self
  401.     {
  402.         $this->identifiantFiscal $identifiantFiscal;
  403.         return $this;
  404.     }
  405.     public function getIban(): ?string
  406.     {
  407.         return $this->iban;
  408.     }
  409.     public function setIban(?string $iban): self
  410.     {
  411.         $this->iban $iban;
  412.         return $this;
  413.     }
  414.     public function getBankName(): ?string
  415.     {
  416.         return $this->bankName;
  417.     }
  418.     public function setBankName(?string $bankName): self
  419.     {
  420.         $this->bankName $bankName;
  421.         return $this;
  422.     }
  423.     public function getWebsite(): ?string
  424.     {
  425.         return $this->website;
  426.     }
  427.     public function setWebsite(?string $website): self
  428.     {
  429.         $this->website $website;
  430.         return $this;
  431.     }
  432.     public function getPhoneResponsible1(): ?string
  433.     {
  434.         return $this->phoneResponsible1;
  435.     }
  436.     public function setPhoneResponsible1(?string $phoneResponsible1): self
  437.     {
  438.         $this->phoneResponsible1 $phoneResponsible1;
  439.         return $this;
  440.     }
  441.     public function getPhoneResponsible2(): ?string
  442.     {
  443.         return $this->phoneResponsible2;
  444.     }
  445.     public function setPhoneResponsible2(?string $phoneResponsible2): self
  446.     {
  447.         $this->phoneResponsible2 $phoneResponsible2;
  448.         return $this;
  449.     }
  450.     /**
  451.      * @return Collection|Comment[]
  452.      */
  453.     public function getComments(): Collection
  454.     {
  455.         return $this->comments;
  456.     }
  457.     public function addComment(Comment $comment): self
  458.     {
  459.         if( !$this->comments->contains($comment)) {
  460.             $this->comments[] = $comment;
  461.             $comment->setSupplier($this);
  462.         }
  463.         return $this;
  464.     }
  465.     public function removeComment(Comment $comment): self
  466.     {
  467.         if( $this->comments->removeElement($comment)) {
  468.             // set the owning side to null (unless already changed)
  469.             if( $comment->getSupplier() === $this) {
  470.                 $comment->setSupplier(null);
  471.             }
  472.         }
  473.         return $this;
  474.     }
  475.    
  476.     
  477. }