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.         public function getId(): ?string
  75.         {
  76.             return $this->id;
  77.         }
  78.         public function getName(): ?string
  79.         {
  80.             return $this->name;
  81.         }
  82.         public function setName(string $name): static
  83.         {
  84.             $this->name $name;
  85.             return $this;
  86.         }
  87.         public function getPhone(): ?string
  88.         {
  89.             return $this->phone;
  90.         }
  91.         public function setPhone(?string $phone): static
  92.         {
  93.             $this->phone $phone;
  94.             return $this;
  95.         }
  96.         public function getAddress(): ?string
  97.         {
  98.             return $this->address;
  99.         }
  100.         public function setAddress(?string $address): static
  101.         {
  102.             $this->address $address;
  103.             return $this;
  104.         }
  105.         public function getCivic(): ?string
  106.         {
  107.             return $this->civic;
  108.         }
  109.         public function setCivic(?string $civic): static
  110.         {
  111.             $this->civic $civic;
  112.             return $this;
  113.         }
  114.         public function getZip(): ?string
  115.         {
  116.             return $this->zip;
  117.         }
  118.         public function setZip(?string $zip): static
  119.         {
  120.             $this->zip $zip;
  121.             return $this;
  122.         }
  123.         public function getEmail(): ?string
  124.         {
  125.             return $this->email;
  126.         }
  127.         public function setEmail(?string $email): static
  128.         {
  129.             $this->email $email;
  130.             return $this;
  131.         }
  132.         public function getIdCity(): ?string
  133.         {
  134.             return $this->idCity;
  135.         }
  136.         public function setIdCity(?string $idCity): static
  137.         {
  138.             $this->idCity $idCity;
  139.             return $this;
  140.         }
  141.         public function getWarehouse(): ?Warehouse
  142.         {
  143.             return $this->warehouse;
  144.         }
  145.         public function setWarehouse(?Warehouse $warehouse): static
  146.         {
  147.             // unset the owning side of the relation if necessary
  148.             if ($warehouse === null && $this->warehouse !== null) {
  149.                 $this->warehouse->setDestination(null);
  150.             }
  151.             // set the owning side of the relation if necessary
  152.             if ($warehouse !== null && $warehouse->getDestination() !== $this) {
  153.                 $warehouse->setDestination($this);
  154.             }
  155.             $this->warehouse $warehouse;
  156.             return $this;
  157.         }
  158. }