src/Entity/Slave/Destination.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Slave;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="eposm_s_destination")
  9.  * @ORM\Entity(repositoryClass="App\Repository\Slave\DestinationRepository")
  10.  */
  11. class Destination
  12. {       
  13.     public function __toString(){
  14.         return $this->getName();
  15.     }
  16.     
  17.     public function getCanDelete($user){
  18.         if(!$this->warehouse->getCanDelete($user)) return false;
  19.         return true;
  20.     }
  21.     public function displayAddress(){
  22.         $result '';
  23.         if($this->address != null$result.= $this->address;
  24.         if($this->civic != null$result.= ' '.$this->civic;
  25.         if($this->zip != null$result.= ', '.$this->zip;
  26.         return $result;
  27.     }
  28.     /**
  29.      * @ORM\Column(name="id", type="bigint")
  30.      * @ORM\Id
  31.      * @ORM\GeneratedValue(strategy="AUTO")
  32.      */
  33.     protected $id;
  34.     
  35.     /**
  36.      * @ORM\Column(name="name", type="string", length=191)
  37.      */
  38.     protected $name;
  39.     
  40.     /**
  41.      * @ORM\Column(name="phone", type="string", nullable=true, length=191)
  42.      */
  43.     protected $phone;
  44.     
  45.     /**
  46.      * @ORM\Column(name="address", type="string", nullable=true, length=191)
  47.      */
  48.     protected $address;
  49.     
  50.     /**
  51.      * @ORM\Column(name="civic", type="string", nullable=true, length=191)
  52.      */
  53.     protected $civic;
  54.     
  55.     /**
  56.      * @ORM\Column(name="zip", type="string", nullable=true, length=191)
  57.      */
  58.     protected $zip;
  59.     
  60.     /**
  61.      * @ORM\Column(name="email", type="string", nullable=true, length=191)
  62.      */
  63.     protected $email;
  64.     
  65.     /**
  66.      * @ORM\Column(name="id_city", type="bigint", nullable=true)
  67.      */
  68.     protected $idCity;
  69.     // OneToOne
  70.         /**
  71.          * @ORM\OneToOne(targetEntity="App\Entity\Slave\Warehouse", mappedBy="destination")
  72.          */
  73.         private $warehouse;
  74.     //
  75.     public function getId(): ?string
  76.     {
  77.         return $this->id;
  78.     }
  79.     public function getName(): ?string
  80.     {
  81.         return $this->name;
  82.     }
  83.     public function setName(string $name): self
  84.     {
  85.         $this->name $name;
  86.         return $this;
  87.     }
  88.     public function getPhone(): ?string
  89.     {
  90.         return $this->phone;
  91.     }
  92.     public function setPhone(?string $phone): self
  93.     {
  94.         $this->phone $phone;
  95.         return $this;
  96.     }
  97.     public function getAddress(): ?string
  98.     {
  99.         return $this->address;
  100.     }
  101.     public function setAddress(?string $address): self
  102.     {
  103.         $this->address $address;
  104.         return $this;
  105.     }
  106.     public function getCivic(): ?string
  107.     {
  108.         return $this->civic;
  109.     }
  110.     public function setCivic(?string $civic): self
  111.     {
  112.         $this->civic $civic;
  113.         return $this;
  114.     }
  115.     public function getZip(): ?string
  116.     {
  117.         return $this->zip;
  118.     }
  119.     public function setZip(?string $zip): self
  120.     {
  121.         $this->zip $zip;
  122.         return $this;
  123.     }
  124.     public function getEmail(): ?string
  125.     {
  126.         return $this->email;
  127.     }
  128.     public function setEmail(?string $email): self
  129.     {
  130.         $this->email $email;
  131.         return $this;
  132.     }
  133.     public function getIdCity(): ?string
  134.     {
  135.         return $this->idCity;
  136.     }
  137.     public function setIdCity(?string $idCity): self
  138.     {
  139.         $this->idCity $idCity;
  140.         return $this;
  141.     }
  142.     public function getWarehouse(): ?Warehouse
  143.     {
  144.         return $this->warehouse;
  145.     }
  146.     public function setWarehouse(?Warehouse $warehouse): self
  147.     {
  148.         // unset the owning side of the relation if necessary
  149.         if ($warehouse === null && $this->warehouse !== null) {
  150.             $this->warehouse->setDestination(null);
  151.         }
  152.         // set the owning side of the relation if necessary
  153.         if ($warehouse !== null && $warehouse->getDestination() !== $this) {
  154.             $warehouse->setDestination($this);
  155.         }
  156.         $this->warehouse $warehouse;
  157.         return $this;
  158.     }
  159. }