src/Entity/Owner.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\OwnerRepository")
  8.  */
  9. class Owner
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255, nullable=true)
  19.      */
  20.     private $firstname;
  21.     /**
  22.      * @ORM\Column(type="string", length=255, nullable=true)
  23.      */
  24.     private $lastname;
  25.     /**
  26.      * @ORM\Column(type="smallint", nullable=true)
  27.      */
  28.     private $gender;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=true)
  31.      */
  32.     private $email;
  33.     /**
  34.      * @ORM\ManyToMany(targetEntity="App\Entity\store", inversedBy="owner")
  35.      */
  36.     private $store;
  37.     public function __construct()
  38.     {
  39.         $this->store = new ArrayCollection();
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getFirstname(): ?string
  46.     {
  47.         return $this->firstname;
  48.     }
  49.     public function setFirstname(?string $firstname): self
  50.     {
  51.         $this->firstname $firstname;
  52.         return $this;
  53.     }
  54.     public function getLastname(): ?string
  55.     {
  56.         return $this->lastname;
  57.     }
  58.     public function setLastname(string $lastname): self
  59.     {
  60.         $this->lastname $lastname;
  61.         return $this;
  62.     }
  63.     public function getFullname(): ?string
  64.     {
  65.         return ucfirst($this->firstname).' '.strtoupper($this->lastname);
  66.     }
  67.     public function getGender(): ?int
  68.     {
  69.         return $this->gender;
  70.     }
  71.     public function setGender(?int $gender): self
  72.     {
  73.         $this->gender $gender;
  74.         return $this;
  75.     }
  76.     public function getEmail(): ?string
  77.     {
  78.         return $this->email;
  79.     }
  80.     public function setEmail(?string $email): self
  81.     {
  82.         $this->email $email;
  83.         return $this;
  84.     }
  85.     public function getStore(): ?store
  86.     {
  87.         return $this->store;
  88.     }
  89.     public function setStore(?store $store): self
  90.     {
  91.         $this->store $store;
  92.         return $this;
  93.     }
  94.     public function addStore(store $store): self
  95.     {
  96.         if (!$this->store->contains($store)) {
  97.             $this->store[] = $store;
  98.         }
  99.         return $this;
  100.     }
  101.     public function removeStore(store $store): self
  102.     {
  103.         if ($this->store->contains($store)) {
  104.             $this->store->removeElement($store);
  105.         }
  106.         return $this;
  107.     }
  108. }